I wan to send an email from a linux command. I installed in ubuntu ssmtp, then I configured it in /etc/ssmtp/ssmtp.conf:
[email protected]
mailhub=smtp.gmail.com:587
rewriteDomain=gmail.com
FromLineOverride=YES
[email protected]
AuthPass=xxxxxxxxx
UseTLS=YES
UseSTARTTLS=YES
then I tried to send the email like that:
ssmtp [email protected] < msg.txt
But I got this error:
ssmtp: Authorization failed (535 5.7.8 https://support.google.com/mail/?p=BadCredentials t187sm393455wmt.25 - gsmtp)
then I tried with sendmail command:
echo -n 'Subject: test\n\nTesting ssmtp' | sendmail -v [email protected]
But I got the same error:
[<-] 220 smtp.gmail.com ESMTP a22sm418259wmd.20 - gsmtp
[->] EHLO omar-X550LC
[<-] 250 SMTPUTF8
[->] STARTTLS
[<-] 220 2.0.0 Ready to start TLS
[->] EHLO omar-X550LC
[<-] 250 SMTPUTF8
[->] AUTH LOGIN
[<-] 334 VXNlcm5hbWU6
[->] b21hci5rYWxsZWwzQGdtYWlsLmNvbQ==
[<-] 334 UGFzc3dvcmQ6
[<-] 535 5.7.8 https://support.google.com/mail/?p=BadCredentials a22sm418259wmd.20 - gsmtp
sendmail: Authorization failed (535 5.7.8 https://support.google.com/mail/?p=BadCredentials a22sm418259wmd.20 - gsmtp)
seems like that there's something wrong or missing in ssmtp config. Is there any suggestion to fix this issue?
Did you try reading the support link it included in the error message? In addition to the possibility that you're supplying the wrong password, it gives a few other possibilities: