I want to send email using my office365 smtp credentials in laravel application. i have make changes in my .env file for email settings as below:
MAIL_DRIVER=smtp
MAIL_HOST=smtp.office365.com
MAIL_PORT=587
MAIL_USERNAME=info@***.com
MAIL_PASSWORD=*******
MAIL_ENCRYPTION=tls
while i am trying to send email i got error like
Failed to authenticate on SMTP server with username \"[email protected]\" using 2 possible authenticators. Authenticator LOGIN returned Swift_TransportException: Expected response code 235 but got code \"535\", with message \"535 Incorrect authentication data\r\n\"
my email sending code is as below
Mail::send(array(), array(), function ($m) use ($templatecontent) {
$m->from('customerservice@****.com', 'TEST');
$m->to('[email protected]', 'Test')
->subject($templatecontent['subject'])
->setBody($templatecontent['content'], 'text/html');
});
Can anyone guide me what is the issue and how to solve this issue?
php artisan cache:clear
? – Vermifugecomposer require
orcomposer update
commands (I assume local command line?) and then upload all your project files to the server so the updated files are updated on the server too – Vermifuge