2

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.

Liso
  • 15,377
  • 3
  • 51
  • 80

1 Answers1

5

You need to 'allow less secure apps', the settings are located within Google account settings—to enable the settings please visit this link https://myaccount.google.com/lesssecureapps.

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=<john@mail.com>, 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.

Liso
  • 15,377
  • 3
  • 51
  • 80