Setting Up Mail and Sendmail

To get sendmail to work you need to do something like the following.

First we must set the smtp server.

$ cd /etc/mail
$ sudo vi sendmail.mc
$ # comment in SMART_HOST line and fill in the smtp host
$ # for example: define(`SMART_HOST', `ironport.sfgov.org')dnl
$ # for example: define(`SMART_HOST', `ompmta01.sfgov.org')dnl

$ yum list sendmail-cf
$ sudo yum install sendmail-cf
$ sudo make sendmail.cf
$ sudo /etc/init.d/sendmail restart

We also want to forward the email for root.

$ sudo vi /etc/aliases

and make sure there is a line like this

# Person who should get root's mail
root:           paul.mccullough@sfgov.org, jeff.johnson@sfgov.org

then type

$ sudo newaliases

As for crontab, every crontab should have this sort of layout with an email at the top:

MAILTO=paul.mccullough@sfgov.org, jeff.johnson@sfgov.org
15 1 * * 2-6 /var/lib/pgsql/replication/scripts/pg_resync_replica
#15 1 * * 2-6 /var/lib/pgsql/replication/scripts/pg_resync_replica > /dev/null 2>&1
30 17 * * * /bin/cat /var/lib/pgsql/foo