PHP\'s mail
function seems to deliver mail on a clean system, with no apparent configuration done by the administrator or webmaster (no SMTP configuration in
You can detect how it works as below.
$ ltrace php -r "mail('tester@127.0.0.1', 'Test', 'Hello world');" 2>&1 | grep sendmail
memcpy(0x095ea168, "sendmail_from", 14) = 0x095ea168
memcpy(0x095ea1e0, "sendmail_path", 14) = 0x095ea1e0
popen("/usr/sbin/sendmail -t -i ", "w") = 0x0977c7c0
From the results of the above command can be seen that the popen()
function opens the process of /usr/sbin/sendmail -t -i
.
$ ls -l /usr/sbin/sendmail
... /usr/sbin/sendmail -> exim4
So sendmail
is the symbolic link to exim4
and hence sendmail -t -i
invokes exim4 -t -i
.
And in the manual page of exim4
you can read about these options -t -i
:
$ man exim4 | grep ' -t -i'
-ti This option is exactly equivalent to -t -i. It is provided for compatibility with Sendmail.
Install snoopy and run:
# grep snoopy /var/log/auth.log | tail
... php -r mail('tester@127.0.0.1', 'Test', 'Hello world');
... /usr/sbin/sendmail -t -i
... /usr/sbin/exim4 -Mc 1YxxYn-0006a7-Nw
... /usr/sbin/exim4 -t -oem -oi -f <> -E1YxxYn-0006a7-Nw
... /usr/sbin/exim4 -Mc 1YxxYn-0006aB-Oj
The results of the above command show the sequence of the commands which were performed.