I tried to sending out an email using php mail()
function but it failed somehow, complaining that a real domain name is required. The following is observed in the maillog:
sendmail 4984 r25984: from=apache, size=273, class=0, nrcpts=1, msgid=<201.r25@localhost.localdomain>, relay=apache@localhost
sendmail 4985 r25985: ruleset=check_mail, arg1=, relay=mydomain.com [127.0.0.1], reject=553 5.5.4 ... Real domain name required for sender address
sendmail 4984 r25984: to=external@server.com, ctladdr=apache (48/48), delay=00:00:01, xdelay=00:00:00, mailer=relay, pri=30273, relay=[127.0.0.1] [127.0.0.1], dsn=5.6.0, stat=Data format error
sendmail 4984 r25984: r25984: DSN: Data format error
cron is able to send email to external@server.com whenever there is a problem with logrotate. I am not sure why php is unable to do so. I tried making changes to the default configuration in `sendmail.mc with the following:
MASQUERADE_AS(`mydomain.com')dnl
FEATURE(masquerade_envelope)dnl
FEATURE(masquerade_entire_domain)dnl
MASQUERADE_DOMAIN(localhost)dnl
MASQUERADE_DOMAIN(localhost.localdomain)dnl
MASQUERADE_DOMAIN(mycom)dnl
But, it doesn't seem to have any effect. The header from address in php mail function has already been set. I have also ensured that SELinux httpd_can_sendmail
is enabled. What else to I need to do to get the mail delivered?