In my Laravel-5.8 project I am trying to send email/notification using office365
config/mail.php
<?php
return [
'driver' => env('MAIL_DRIVER', 'smtp'),
'host' => env('MAIL_HOST', 'smtp.office365.com'),
'port' => env('MAIL_PORT', 587),
'from' => [
'address' => env('MAIL_FROM_ADDRESS', 'testingemail@mycompany.com'),
'name' => env('MAIL_FROM_NAME', 'JJJ'),
],
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
'username' => env('MAIL_USERNAME','testing@mycompany.com'),
'password' => env('MAIL_PASSWORD','testing'),
'sendmail' => '/usr/sbin/sendmail -bs',
'markdown' => [
'theme' => 'default',
'paths' => [
resource_path('views/vendor/mail'),
],
],
'log_channel' => env('MAIL_LOG_CHANNEL'),
];
But I got this error:
#message: """ Failed to authenticate on SMTP server with username "testing@mycompany.com" using 2 possible authenticators. Authenticator LOGIN returned Expected response code 235 but got code "535", with message "535 5.7.3 Authentication unsuccessful [LO2P265CA0268.GBRP265.PROD.OUTLOOK.COM] ◀ ". Authenticator XOAUTH2 returned Expected response code 235 but got code "535", with message "535 5.7.3 Authentication unsuccessful [LO2P265CA0268.GBRP265.PROD.OUTLOOK.COM] ◀ ". """
How do I resolve it?
Thanks