Sendmail – Crontab and Email Updates
Cron automatically sends out email to the job’s runner a report of the issued cronjob. This can either be an excellent and invaluable feature or an annoyance. To stop the emails from coming add this to the end of any particular cronjob:
>/dev/null 2>&1
Without the above line the email will be delivered to the mailbox. You can send the mail anywhere. I prefer setting up aliases in /etc/mail/aliases. This associated a particular user with possibly the email address of another domain. You can also put a MAILTO directive directly at the top of a particular users crontab:
MAILTO=" "
Note that sendmail will send outbound mail without any configurations necessary. Just install it:
sudo apt-get install sendmail
Test sendmail with:
mail -v user@domain.com
Write a subject, press enter, add something meaningless to the body, press control-d, then press enter on CC. Accepting mail is another story. To accecpt mail you need to open port 25, and make sure the external ip address is routing it to the local ip machine running sendmail. Then you have to configure sendmail to listen and accecpt email coming from this port. Then you need another application to retreive the mail from the users inbox. I prefer Dovecot. For more information on Dovecot please refer to: