I'm learning how to send email to the user whenever their system role change using Laravel 8 and I had this issue where most tutorials that I'm following requires the Google Account to turn on the Less Secure Apps, but I cannot change the settings in the Google Account anymore it says This setting is no longer available
. I am using Laravel and Jetstream. Below is the error I'm getting:
Failed to authenticate on SMTP server with username "myEmail@gmail.com" using the
following authenticators: "LOGIN", "PLAIN", "XOAUTH2". Authenticator "LOGIN" returned
"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 j2-20020a654282000000b003fe28130b12sm5399227pgp.62 - gsmtp".". Authenticator
"PLAIN" returned "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 j2-20020a654282000000b003fe28130b12sm5399227pgp.62 - gsmtp".". Authenticator
"XOAUTH2" returned "Expected response code "235" but got code "334", with message "334 eyJzdGF0dXMiOiI0MDAiLCJzY2hlbWVzIjoiQmVhcmVyIiwic2NvcGUiOiJodHRwczovL21haWwuZ29vZ2xlLmNvbS8ifQ==".".`
Does anyone know how to send emails in laravel or a tutorial on doing it? Thank you.
Follow this to generate new apps password and set your env file like this
MAIL_MAILER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=YOUR_GMAIL@gmail.com
MAIL_PASSWORD=YOUR_GENERATED_PASSWORD
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS="hello@example.com"
MAIL_FROM_NAME="${APP_NAME}"
make sure your port and encryption setting is also changed in mail.php
'smtp' => [
'transport' => 'smtp',
'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
'port' => env('MAIL_PORT', 587),
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
'username' => env('MAIL_USERNAME'),
'password' => env('MAIL_PASSWORD'),
'timeout' => null,
],
you probably need to clear cache before test it out
php artisan config:cache
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.