ssmtp won't send cron email

I can't figure out why cron on my AWS EC2 (Ubuntu 14.04.1 LTS (GNU/Linux 3.13.0-32-generic x86_64)) can't seem to send email out via sSmtp to AWS SES.

This works: echo "test" | ssmtp [email protected] and I get an email from my local user.

This works: echo "test" | sudo ssmtp [email protected] and I get an email from root.

But, when cron runs and tries to send an email, I get nothing and this appears in the syslogs: sSMTP[14608]: 554 Transaction failed: Missing final '@domain' or sometimes: 554 Transaction failed: User name is missing: 'Cron Daemon <root>'.

Who is cron trying to send an email as? I would have assumed it was root.

/etc/crontab:

MAILTO="[email protected]"

(I've also tried MAILTO=root)

/etc/ssmtp/revaliases:

root:[email protected]:email-smtp.us-east-1.amazonaws.com:465
me:[email protected]:email-smtp.us-east-1.amazonaws.com:465

/etc/ssmtp/ssmtp.conf:

[email protected]
mailhub=email-smtp.us-east-1.amazonaws.com:465
rewriteDomain=myemail.com
hostname=myemail.com
#UseSTARTTLS=YES
UseTLS=YES
AuthUser=XXXXXXXXXXXXXXXXX
AuthPass=XXXXXXXXXXXXXXXXX
AuthMethod=LOGIN
FromLineOverride=YES

Based on some Googling, the MAILFROM= doesn't seem to work on Ubuntu, and changing it seems to have no effect (from the root cron and my local user cron).

I'm confused and perplexed. sSmtp doesn't seem to have any debugging options to help understand who the cron email is coming from and going to and look at the headers.

The server is a very minimal install and I don't want to install postfix just to send 10 emails a day (mostly log files).

Thanks!


So, afaict SES requires a domain in both the "from" and "to" fields.

While MAILFROM= is not supported on Ubuntu's cron, you can set FromLineOverride=NO in ssmtp.conf, and ssmtp will force the "from" address to be "root@hostname" instead of just "root". This takes care of the "from" address.

Now - you also need to make sure that the "to" address has a domain name (by default it's also just "root"). This can be fixed by adding a [email protected] line to /etc/crontab.

This solved my "554 Transaction failed: Missing final '@domain'" issues. I did not run into your "Transaction failed: User name is missing: 'Cron Daemon '" messages so I can't comment on that.

The key takeaway from all this is that Debug=YES in ssmtp.conf writes a bunch of info to the syslog.