Arora
Arora

Reputation: 41

Laravel Connection could not be established with host smtp.office365.com

for outlook, it neither works in localhost nor in production server. but for testing purpose, I used Gmail in localhost and it worked.

but again in production, it didn't work.

MAIL_DRIVER smtp
MAIL_HOST smtp.office365.com
MAIL_PORT 587, 
MAIL_USERNAME ********, 
MAIL_PASSWORD ********, 
MAIL_ENCRYPTION tsl 

Upvotes: 4

Views: 8113

Answers (3)

hamil.Dev
hamil.Dev

Reputation: 388

in my case, change port 587 to 25 work fine.

Microsoft Documentation

Upvotes: 0

Vishnu Kumar
Vishnu Kumar

Reputation: 15

Try

'driver' => env('MAIL_DRIVER', 'sendmail'),
'host' => env('MAIL_HOST', 'localhost'),

it works.

Upvotes: -3

Udhav Sarvaiya
Udhav Sarvaiya

Reputation: 10061

Just set up correct Configuration:

MAIL_DRIVER=smtp
MAIL_HOST=smtp.office365.com
MAIL_PORT=587
MAIL_USERNAME= //your username
MAIL_PASSWORD= //your password
MAIL_ENCRYPTION=tls

After .env edit must be clear cache: php artisan config:cache

Upvotes: 5

Related Questions