Linux – Sendmail configuration for a simple web server that needs mail() to work in PHP

centosconfigurationlinuxPHPsendmail

I have a web server (CentOS 5) that I need to be able to send mail from using PHP mail() function.

I have the PHP mail() function working properly. The Sendmail configuration is what I need to tweak.

I need to configure sendmail on the server to send "From" "support@mydomain.com".

I know, if you go to the sendmail FAQ, it will say "We discuss this in detail in the MASQUERADING AND RELAYING ( http://www.sendmail.org/m4/masquerading.html ) section" but I've been through that section over and over and over and still my mail log shows something like this:


Aug 4 15:11:11 tdbb sendmail[30582]: n73Mngeq028343: to=, ctladdr= (48/48), delay=20:21:29, xdelay=00:00:01, mailer=esmtp, pri=2129764, relay=smtp.easydns.com. [64.68.200.52], dsn=2.0.0, stat=Sent (Ok: queued as 6120181E4C)

I would rather it said:


Aug 4 15:11:11 tdbb sendmail[30582]: n73Mngeq028343: to=, ctladdr= (48/48), delay=20:21:29, xdelay=00:00:01, mailer=esmtp, pri=2129764, relay=smtp.easydns.com. [64.68.200.52], dsn=2.0.0, stat=Sent (Ok: queued as 6120181E4C)

Note the ctladdr part.

Here is what I've done:

In /etc/mail/sendmail.mc

I have enabled the line:


MASQUERADE_AS(`mydomain.com')dnl

and


FEATURE(masquerade_envelope)dnl

Other than those two lines, I don't think I've changed anything from the default configuration.

Of course, I go to /etc/mail and run 'make', 'make restart' when I'm finished with the configuration file.

Best Answer

Ensure those settings have changed the sendmail.cf file. I have had to battle sendmail configurations before and it takes some patience and understanding. I usually m4 the files for it to regenerate the cf file then restart the sendmail service.

Try these as well:

MASQUERADE_AS(`mydomain.com')dnl
MASQUERADE_DOMAIN(`mydomain.com')dnl
FEATURE(`masquerade_envelope')dnl

Those usually work for me. Good luck.

Related Topic