{{tag>php mail laravel microsoft}}
====== Send mail with PHP Laravel/swiftmailer using Microsoft smtp.office365.com ======
In .env file change
''"MAIL_ENCRYPTION=starttls" to "MAIL_ENCRYPTION=tls"''
In //conf/mail.php//, line 59 set ''MAIL_FROM_ADDRESS'' to be same as in //.env// file ''MAIL_USERNAME'' value
'host' => env('MAIL_HOST', 'your-mail-host'),
'from' => [
'address' => env('MAIL_FROM_ADDRESS', 'your-mail@host.com'),
'name' => env('MAIL_FROM_NAME', 'Your User Name'),
],
.env file
...
MAIL_USERNAME=your-mail@host.com
...
====== Tested on ======
*
====== See also ======
====== References ======
* https://stackoverflow.com/questions/62577544/how-do-i-use-starttls-with-swiftmailer-in-php
* https://stackoverflow.com/questions/52765247/expected-response-code-250-but-got-code-554-with-message-554-5-2-0-stor-edr
* https://docs.microsoft.com/en-us/exchange/mail-flow-best-practices/how-to-set-up-a-multifunction-device-or-application-to-send-email-using-microsoft-365-or-office-365