What mailer does cron use to send mail?

I am trying to debug an issue with cron not sending mail on a Centos 6 box that I did not configure. How can I determine which mailer cron is using to send mail? The crontab man page has this to say, in part:

In addition to LOGNAME, HOME, and SHELL, cron(8) will look at MAILTO if it has any reason to send mail as a result of running commands in "this" crontab. If MAILTO is defined (and non-empty), mail is sent to the user so named. If MAILTO is defined but empty (MAILTO=""), no mail will be sent. Otherwise mail is sent to the owner of the crontab. This option is useful if you decide on /bin/mail instead of /usr/lib/sendmail as your mailer when you install cron -- /bin/mail doesn´t do aliasing, and UUCP usually doesn´t read its mail.

The part with asterisks is the part that has me wondering "Well, is it sendmail or mail?"


Solution 1:

A quick Google shows me that /etc/sysconfig/crond is the file that defines what mailer is used by cron.

Solution 2:

According to the man page for cron(8) (the daemon that actually sends the message):

   -m     This  option  allows you to specify a shell command string to use for 
          sending cron mail output instead of sendmail(8).  This command must 
          accept a fully formatted mail message (with headers) on stdin and send
          it as a mail message to the recipients specified in the mail headers.

That leads me to believe that it's using sendmail by default. Let's verify with strace:

Set up a cron job that'll generate email:

user@host1 ~:
$ crontab -e
crontab: installing new crontab
user@host1 ~:
$ crontab -l
[email protected]
*/5 * * * * echo "testing"

Now find the process ID for crond:

user@host1 ~:
$ ps auxww | grep crond
root      9684  0.0  0.0 117280  1296 ?        Ss   Jul22   0:17 crond
user     36344  0.0  0.0 103240   884 pts/2    S+   23:01   0:00 grep crond

Attach to the crond process with strace, looking for process related activity. As strace writes to stderr I've redirected it to stdout and grepped for 'mail':

root@host1 ~:
# strace -fp 9684 -s 1024 -e trace=process 2>&1 | grep mail
[pid 36204] execve("/usr/sbin/sendmail", ["/usr/sbin/sendmail", "-FCronDaemon", "-i", "-odi", "-oem", "-oi", "-t", "-f", "root"], [/* 16 vars */]) = 0
^C

Yep, it's sendmail.