Cannot send mail from command line, sasl authentication error

I followed the instructions here How to send an email using command line?, but it dont work. When I test mailing someone it return:

(SASL authentication failed; server smtp.gmail.com[74.125.130.109] said: 535-5.7.8 Username and Password not accepted.

I have unlocked captcha as suggested by the answer, still not working.

1 Answer

You need to 'allow less secure apps', the settings are located within Google account settings—to enable the settings please visit this link .

Then, try sending email again, it should work, you can also check the recent mail log by typing:

tail -f /var/log/mail.log

Usually the email success message goes along with this line.

hostname postfix/smtp[2875]: F5182534OUA: to=<>, relay=smtp.gmail.com[74.125.130.109]:587, delay=2.8, delays=0.07/0/1.6/1.1, dsn=2.0.0, status=sent

If you feel uneasy allowing 'less secure apps', you can use app password—in which you can generate standalone password for postfix itself. But it requires settings up 2 step verification, refer to this link for more details.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like