So, my laravel website can send the emails on localhost with same configuration but once I deployed the changes it can’t send the email and here are the logs;
Connection could not be established with host "smtp.office365.com:587": stream_socket_client(): Unable to connect to smtp.office365.com:587 (Connection timed out)
I have tried to use 465, ssl and 587,tls… I also tried to use port 25 for office365.
I am using godaddy and asked their CS and they said they need to update my DNS and now I am waiting for that but I am not sure this will solve my problem.
However, when I go to config/mail.php, and replace transport => “smtp” to transport => “mail” it works out but the mail sending speed is very slow as compared to my localhost speed which I am doing through transport smtp.
My .env config:
MAIL_MAILER=smtp
MAIL_HOST=smtp.office365.com
MAIL_PORT=587
[email protected]
MAIL_PASSWORD=passowr/
MAIL_ENCRYPTION=tls
[email protected]
MAIL_FROM_NAME="SiteName"
Mailer config: /config/mail.php:
'mailers' => [
'smtp' => [
'transport' => 'smtp',
'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
'port' => env('MAIL_PORT', 587),
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
'username' => env('MAIL_USERNAME'),
'password' => env('MAIL_PASSWORD'),
'timeout' => null,
'local_domain' => env('MAIL_EHLO_DOMAIN'),
'verify_peer' => false,
],
'ses' => [
'transport' => 'ses',
],
'mailgun' => [
'transport' => 'mailgun',
],
'postmark' => [
'transport' => 'postmark',
],
'sendmail' => [
'transport' => 'sendmail',
'path' => env('MAIL_SENDMAIL_PATH', '/usr/sbin/sendmail -bs -i'),
],
'log' => [
'transport' => 'log',
'channel' => env('MAIL_LOG_CHANNEL'),
],
'array' => [
'transport' => 'array',
],
'failover' => [
'transport' => 'failover',
'mailers' => [
'smtp',
'log',
],
],
]
Thats why I need your help. Please anyone who have experienced this problem.
I have tried to use 465, ssl and 587,tls… I also tried to use port 25 for office365.
I am using godaddy and asked their CS and they said they need to update my DNS and now I am waiting for that but I am not sure this will solve my problem.
However, when I go to config/mail.php, and replace transport => “smtp” to transport => “mail” it works out but the mail sending speed is very slow as compared to my localhost speed which I am doing through transport smtp.