1

I'm trying to create a cron job that will periodically email me. To do this, I am trying to learn how to use sendmail.

I have created the following files in /etc/ssmtp

revaliases:

# sSMTP aliases
# 
# Format:       local_account:outgoing_address:mailhub
#
# Example: root:your_login@your.domain:mailhub.your.domain[:port]
# where [:port] is an optional port number that defaults to 25.

root:awswarnings@gmail.com:smtp.gmail.com:587

and

ssmtp.conf

UseSTARTTLS=YES
root=awswarnings@gmail.com
mailhub=smtp.gmail.com:587
AuthUser="Jonathan Smythe"
AuthPass=my,password?

I've enabled POP and IMAP in my gmail account and also told it to allow less secure apps. However, when I try to send a test email from the command line, I get the following errors:

ubuntu@ip-172-31-30-193:~$ echo "hello" | sudo sendmail me@gmail.com
sendmail: Authorization failed (535 5.7.8  https://support.google.com/mail/?p=BadCredentials c202sm20828558qkb.19 - gsmtp)

I've tested the password, and it is accurate - at least I can log in and out repeatedly without problems.

What else do I need to do, or haven't I done?

user1245262
  • 6,968
  • 8
  • 50
  • 77

0 Answers0