Crontab and sSMTP
12,758
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 [email protected] < /home/a/a-msg.txt
Related videos on Youtube
Author by
akarapatis
Updated on September 18, 2022Comments
-
akarapatis over 1 year
My server is Ubuntu 12.04.3 Cron jobs are working fine. I can send emails through command line, either using
mail
,ssmtp
orsendmail
. I have set the correct email address on top of thecrontab -e
[email protected] * * * * * 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?
-
Aurelia over 10 years
cron
does run as root, right? You can try adding root to themail
group, but it shouldn't be required.usermod -a -G mail root
-
-
akarapatis over 9 yearsI am aware of this solution. But it is only a workaround. I preferred a solution that applied to the whole crontab
-
meanbunny over 8 yearsBeen looking all over for this solution.
-
E.S. almost 6 yearsHmm this didn't do anything for me. I assume the
/usr/sbin/ssmtp [email protected] < xyz
xyz refers to the stdout of your command. I get a 550 error this way. Am I missing some steps?