I'm using supervisor to send email. At the first place all email was successfully sent using queue. All email goes into jobs table then executed.
Couple days ago I didn't get the notification email anymore. The jobs table is empty, while failed_jobs table full of failed to sent mail.
It return 2 error message one after another. The first one is
ErrorException: fwrite(): SSL operation failed with code 1. OpenSSL Error messages:
error:1420C0CF:SSL routines:ssl_write_internal:protocol is shutdown in /var/www/html/admin/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php:223
and the second one is
Swift_TransportException: Expected response code 250 but got an empty response in /var/www/html/admin/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php:447
I already allow less secure apps on my gmail account and im using gapps email.
This is my supervisor worker setting
[program:offerletter]
process_name=%(program_name)s_%(process_num)02d
command=php /var/www/html/admin/artisan queue:work database --sleep=3 --tries=3 --daemon
autostart=true
autorestart=true
user=root
numprocs=10
redirect_stderr=true
stdout_logfile=/var/www/html/admin/offerletter.log
stopwaitsecs=3600
and here is my smtp setting in env
MAIL_MAILER=smtp
MAIL_HOST=smtp.googlemail.com
MAIL_PORT=587
MAIL_USERNAME=###
MAIL_PASSWORD=###
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS=###
MAIL_FROM_NAME="${APP_NAME}"
Need some help. Thank you.
CodePudding user response:
I think you are going to run into issues using GMail now because they made changes as of May 30th.
"To help keep your account secure, Google will no longer support the use of third-party apps or devices which ask you to sign in to your Google Account using only your username and password. Instead, you’ll need to sign in using Sign in with Google or other more secure technologies, like OAuth 2.0. Learn more"
Based off those env variables you included it looks like you are still using the username and password. You may want to look at: https://github.com/dacastro4/laravel-gmail and use the wrapper to handle the GMail API to send emails.
CodePudding user response:
Update.
I solve the problem by enabling 2FA on the google email setting. Then I create app password and use the app password on email password in env. So far so good and work well.