Am trying to send email by Laravel.
But It's getting error.
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
[email protected]
MAIL_PASSWORD=******
MAIL_ENCRYPTION=tls
$data = array('name'=>"Ripon Uddin", "body" => "Test mail");
Mail::send('email', $data, function($message) {
$message->to('[email protected]','To My Yahoo')->subject('Laravel Test Email');
$message->from('[email protected]','Ripon Uddin (Laravel Lover)');
});
Error gettings :
Failed to authenticate on SMTP server with username "[email protected]" using 3 possible authenticators. Authenticator LOGIN returned Swift_TransportException: Expected response code 235 but got code "535", with message "535-5.7.8 Username and Password not accepted. Learn more at 535 5.7.8 https://support.google.com/mail/?p=BadCredentials r18-v6sm7406256pgv.17 - gsmtp " in
you don't need to have GSuite to do this... I have done this integration alot of times with Laravel & GMail. Just go to your Google Account > Security > Less secure app access and Click on "Turn on access (not recommneded)"See image for more info
Go to this link or app password page of gmail then select 'mail' as "app" and custome name as "device". Then you will get app password.
Just go to your laravel mai.php under config folder in production or env file in dev mode. Paste the generated code on password section 'password' => 'generated code',
After all run: php artisan config:cache
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With