[CentOS] Fwd: When no MTA is installed, How to send an email with a cronjob?

Gordon Messmer gordon.messmer at gmail.com
Tue Jul 23 19:28:54 UTC 2013


On 07/23/2013 03:07 AM, Indunil Jayasooriya wrote:
> I think your method is the easiest way.

It almost certainly isn't easier than installing ssmtp.  Everything that 
you'd have to to to get ssmtp to work you will also need to do to that 
python code, plus you have to manually send email for every job where 
you need it.

> Should I APPEND the PATH of the script (/root/send_email.py) to
> /root/scripts/backup.sh file. ?
>
> I just ran this script (i.e - /root/send_email.py). It worked. I got the
> email. But no subject there.  How can I add a subject called " CRON JOB
> OUTPUT " to the email receive .

You're going to have to create your own RFC compliant headers.  See how 
that's already more complicated than using ssmtp?  (Cron already does 
that work if you install an MTA, such as ssmtp)




More information about the CentOS mailing list