I've been hosted my laravel project in a free hosting (in awardspace). Everything works ok, except sending email. When I try to send an email by compiling the form from the contact page of my project, it returns me this error:
Swift_TransportException
Connection could not be established with host free.mboxhosting.com [Connection refused #111]
This is the outgoing mail settings that free hosting service offers:
This is how i've been set the file .env
MAIL_DRIVER=smtp
MAIL_HOST=free.mboxhosting.com
MAIL_PORT=465
MAIL_USERNAME=contatti@pprivitera.dx.am
MAIL_PASSWORD=mypassword
MAIL_ENCRYPTION=ssl
MAIL_FROM_ADDRESS=contatti@pprivitera.dx.am
MAIL_FROM_NAME=User
And this is how I've been set the config/mail.php file
'driver' => env('MAIL_DRIVER', 'smtp'),
'host' => env('MAIL_HOST', 'free.mboxhosting.com'),
'port' => env('MAIL_PORT', 465),
'from' => [
'address' => env('MAIL_FROM_ADDRESS', 'contatti@pprivitera.dx.am'),
'name' => env('MAIL_FROM_NAME', 'User'),
],
'encryption' => env('MAIL_ENCRYPTION', 'ssl'),
'username' => env('contatti@pprivitera.dx.am'),
'password' => env('mypassword')
Tests I did:
1)I tried to change MAIL_DRIVER from "smtp" to "sendmail" both from .env file and from the mail.php file, but it doesn't work because the website after 4 minutes of loading returns me: The GET method is not supported for this route. Supported methods: POST (I don't understand why, because in local the contact form works perfectly and anyway the Route /contact/submit is set as ::post and the method of my contact form is set as "=post" too)
2)I tried to change the MAIL_ENCRYPTION from "ssl" to "null" so I've changed also the port from 465 to 25 or 587 (both from .env file and from the config/mail.php file) but it returns me the error ([Connection refused #111])
3)I tried to use mailtrap with my credential, both with ssl encryption and with null encryption, using 2525 port or 465 (depend from encryption type used), but it returns me the same error:
Connection could not be established with host smtp.mailtrap.io [Connection refused #111]
4)With mailtrap if I change the MAIL_DRIVER from smtp to sendmail, it returns me the error that I've described in the 1st point
5)In my local machine everything works perfectly, just using mailtrap with MAIL_DRIVER set as smtp and the rest of configuration set with credential of my mailtrap account
I don't understand what's wrong in the configuration. Thanks for the help!
