I tried posting this in stackoverflow, but didn't get any (real good) answers, maybe it's more on this side of the aisle.

I have a problem on a server for which the additional headers get ignored.

Code to reproduce:

$toEmail="customer@domain.com";
$subject="subject";
$message="this is a message";
$fromEmail="Customer Service <customerservice@domain.net>";
$replyToEmail="Customer Service <customerservice@domain.net>";
mail("$toEmail", $subject, $message, "FROM: $fromEmail","-f$replyToEmail");
echo "mail sent";

The from address ends up being: customerservice@domain.net.prod3.domain.net

prod3.domain.net is the name of the server, so it concatenates the from address and the machine name.

Server is LAMP running Centos5.

Thanks!

Cam

link|improve this question
1  
What MTA is use, what are the headers of a real message? Why aren't you using one of the existing PHP mail libraries phpmail/Zend::mail instead of building your own? – Zoredache Nov 23 '11 at 20:50
feedback

3 Answers

I suggest you look more closely at your sendmail configuration. It could be doing masquerading for everything received. There is a setting to tack on the name of your domain automatically.
This is not something people can easily comment on without more specifics.

If you are using sendmail as your mailer, you might attach the sendmail.mc file to this note.

link|improve this answer
1  
The questioner probably is using sendmail, but is not necessarily using Sendmail. – JdeBP Nov 24 '11 at 17:08
feedback

Your $replyToEmail should be only the mail address:

$replyToEmail="customerservice@domain.net";

-f is an argument passed to sendmail. More examples, details and discussion you can find here

link|improve this answer
feedback

This can be set in php.ini by giving sendmail_from a value. I've also seen people set sendmail_path with something like "/usr/sbin/sendmail -t -i -fiamnotnobody@server.org".

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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