Reputation: 31
I am new to laravel and i am not able to send mail using server. Below given my env file and mail.php file
.env
MAIL_MAILER=smtp
MAIL_HOST=mail.infomaniak.com
MAIL_PORT=465
MAIL_USERNAME=***.com
MAIL_PASSWORD=***
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS=***.com
MAIL_FROM_NAME="${APP_NAME}"
config/mail.php
'smtp' => [
'transport' => 'smtp',
'host' => env('MAIL_HOST', 'mail.infomaniak.com'),
'port' => env('MAIL_PORT', 465),
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
'username' => env('MAIL_USERNAME'),
'password' => env('MAIL_PASSWORD'),
'timeout' => null,
'auth_mode' => null,
]
Upvotes: 3
Views: 8560
Reputation: 568
In your env configs change your email encryption to like so: MAIL_ENCRYPTION=ssl
This error is common with "laravel/framework": "^8.75"
Most since the symphony swift mailer is outdated.
I ran into this bug too after pulling my project from version control and re-installing the packages afresh. The solution above solved my problem and from what I understand about the error is that the swift mailer is trying to open a tcp connection to your server using the smtp port but the connection is only allowed/support ssl://mail.yourdomain.com
so that's why you get a timeout on that socket stream.
Hope my approach help solve your problem too.
Upvotes: 6
Reputation: 1
You have to add smtp
before your mail.infomaniak.com
:
smtp.mail.infomaniak.com
Upvotes: 0