Crontabs and SSMTP

cronssmtp

I'm trying to send an email through cron and ssmtp. I created a script with this

#!/bin/bash
printf "Subject:test\n\Test text" | ssmtp email@adress.com

The script works fine when run from the prompt but doesn't work through cron. Ssmtp is sending through gmail if that matters.

The weird thing is according to mail.log the email sent fine.

Best Answer

Here are detailed instructions including gmail.

http://www.pickledbrain.com/2011/04/setting-simple-outgoing-email-on-a-ubuntu-server-using-ssmtp/

The command is

 #!/bin/bash
 printf "Subject:test\n\Test text" | mail email@adress.com
Related Topic