I have had smtp mail working in the past but now cannot get mail to sent from an RPi when using a new gmail account
This new account is just for the RPi because I am reluctant to put my personal email credentials into the ssmtp.conf file.
File ssmtp.conf: (private stuff obscured)
Debug=YES
root=[email protected]
mailhub=smtp.gmail.com:587
AuthUser=[email protected]
AuthPass=SomePass
AuthMethod=LOGIN
UseTLS=YES
UseSTARTTLS=YES
hostname=RPi5
FromLineOverride=YES
File revaliases:
root:[email protected]:smtp.gmail.com:587
pi:[email protected]:smtp.gmail.com:587
I also configured /etc/aliases, but not clear if this is needed:
mailer-daemon: postmaster
postmaster: root
noc: root
security: root
root: pi
pi: [email protected]
If I use the credentials for my personal gmail account then the simple
echo "message" | mail -s "subject" [email protected]
works.
But if I then change the credentials, in all 3 files to the newly created account it does not.
In that case the mail command exits with a non-zero error code and the log file just says that the credentials were not accepted. I have added the debug option, and the resulting log sheds no more light on the issue:
Feb 14 10:50:06 raspberrypi sSMTP[6826]: Set Root="[email protected]"
... various SET commands as per ssmtp.conf
Feb 14 10:50:06 raspberrypi sSMTP[6826]: Set MailHub="smtp.gmail.com"
Feb 14 10:50:06 raspberrypi sSMTP[6826]: via SMTP Port Number="587"
Feb 14 10:50:06 raspberrypi sSMTP[6826]: Creating SSL connection to host
Feb 14 10:50:06 raspberrypi sSMTP[6826]: 220 smtp.gmail.com ESMTP p49sm287688wrb.10 - gsmtp
Feb 14 10:50:06 raspberrypi sSMTP[6826]: EHLO RPi5
Feb 14 10:50:06 raspberrypi sSMTP[6826]: 250 SMTPUTF8
Feb 14 10:50:06 raspberrypi sSMTP[6826]: STARTTLS
Feb 14 10:50:06 raspberrypi sSMTP[6826]: 220 2.0.0 Ready to start TLS
Feb 14 10:50:06 raspberrypi sSMTP[6826]: SSL connection using RSA_AES_128_CBC_SHA1
Feb 14 10:50:06 raspberrypi sSMTP[6826]: EHLO RPi5
Feb 14 10:50:06 raspberrypi sSMTP[6826]: 250 SMTPUTF8
Feb 14 10:50:06 raspberrypi sSMTP[6826]: AUTH LOGIN
Feb 14 10:50:06 raspberrypi sSMTP[6826]: <redacted>
Feb 14 10:50:06 raspberrypi sSMTP[6826]: <redacted>
Feb 14 10:50:06 raspberrypi sSMTP[6826]: 535 5.7.8 https://support.google.com/mail/?p=BadCredentials p49sm287688wrb.10 - gsmtp
Feb 14 10:50:06 raspberrypi sSMTP[6826]: Authorization failed (535 5.7.8 https://support.google.com/mail/?p=BadCredentials p49sm287688wrb.10 - gsmtp)
The new account has the enable less secure apps settings on and I have enabled POP3 and IMAP just because those are the settings on my personal account as well. I can log into the new account, so the credentials are right, and I can send and receive mail from/to this new account. It looks like the login is being attempted and rejected, but I have no idea why. So have I missed something in the RPi configuration or is there any change in policy from google regarding new accounts?
I have done many searches, but not found anything that I am doing wrong, I am stuck so any help appreciated.