Reputation: 981
We have changed the email server from a provider to another. The where sending with the old email settings but not with the new ones. I am not sure if it`s laravel server or email server.
I will use here my domain as: example.com
I have changed the new email settings in .env:
MAIL_DRIVER=smtp
MAIL_HOST=server.example.com
MAIL_PORT=465
[email protected]
MAIL_PASSWORD=secret
MAIL_ENCRYPTION=ssl
and when we send emails we get this exception in laravel.log
production.ERROR: Connection to tcp://server.example.com:465 Timed Out {"exception":"[object] (Swift_TransportException(code: 0): Connection to tcp://server.example.com:465 Timed Out at /var/www/example.com/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php:473, Swift_IoException(code: 0): Connection to tcp://server.example.com:465 Timed Out at /var/www/example.com/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php:166)
I have tried also with tls instead of ssl but the same error.
I have configure that email [email protected] in thunderbird with the given settings from the provider and works.
Email settings:
incoming: IMAP server.example.com 993 SSL/TLS Encrypted password
outgoing: SMTP server.example.com 465 SSL/TLS Encrypted password
username (email address) and password.
I am missing something ????
Upvotes: 4
Views: 6085
Reputation: 676
As Paolo said changing MAIL_ENCRYPTION to ssl worked for me, but only after running this command also php artisan config:cache
Upvotes: 0
Reputation: 8202
In my case the error was misleading. It's wasn't a timeout but was caused by the wrong encryption setting.
In my case I needed to set MAIL_ENCRYPTION=ssl
Upvotes: 5
Reputation: 3702
If you send your email from an gmail account then try this
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=465
MAIL_USERNAME=your_email (like [email protected])
MAIL_PASSWORD=secret (when you create a app in your google account then get a app secret)
MAIL_ENCRYPTION=ssl
If you do this in your gmail then you can send mail from your gmail account easily
Upvotes: 1