I wan to send an email from a linux command. I installed in ubuntu ssmtp, then I configured it in /etc/ssmtp/ssmtp.conf:
root=mymail@gmail.com
mailhub=smtp.gmail.com:587
rewriteDomain=gmail.com
FromLineOverride=YES
AuthUser=mymail@gmail.com
AuthPass=xxxxxxxxx
UseTLS=YES
UseSTARTTLS=YES
then I tried to send the email like that:
ssmtp receiver_mail@gmail.com < 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 receiver_mail@gmail.com
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?