Ubuntu – Crontab and sSMTP

command linecronemail

My server is Ubuntu 12.04.3
Cron jobs are working fine.
I can send emails through command line, either using mail, ssmtp or sendmail.
I have set the correct email address on top of the crontab -e

MAILTO=myemail@gmail.com

* * * * *  echo blaaah

But what I get in mail.log is

sSMTP[4267]: 550 5.7.1 Client does not have permissions to send as this sender

Which is strange as I am able to send email through command line. Any ideas?

Best Answer

I had a similar problem. The answer for me was actually quite simple.

The user/environment under which cron executes could not find the ssmtp binary. Simply by adding the full path to it achieved success.

# m     h       dom     mon     dow     command
0       9       *       *       *       /usr/sbin/ssmtp a@hotmail.com < /home/a/a-msg.txt
Related Question