Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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=someone@somewhere.com, ctladdr=apache@tdbb.localdomain (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=someone@somewhere.com, ctladdr=support@mydomain.com (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.

share|improve this question

1 Answer 1

up vote 1 down vote accepted

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.

share|improve this answer
    
Thanks but I've got these set and they're not working for me. :( I'll keep playing and post results if I get it working. –  JR Lawhorne Aug 4 '09 at 22:07
    
After some jogging of files, I think this is working properly now. Along the way, I also found an option to put the FROM address in the /etc/php.ini file as an argument to sendmail. (-f) Then, you also have to make sure you disable the warnings if they show up in your log as per: wincent.com/a/knowledge-base/archives/2006/03/… –  JR Lawhorne Aug 5 '09 at 4:08

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.