Reply-To headers sent in php mail()

software development

#1

Hi,
First off, I’m new to Dreamhost and so far glad to be here.

I am teaching myself php and have run into a problem with the reply-to headers being sent by the mail() function.

When I check my e-mail the form submission arrives just fine but when I reply there are two other e-mail addresses in the reply-to field,
these are:
My@runts.dreamhost.com
testReply-To@runts.dreamhost.com

Obviously I am on runts and I am not including these addresses in my script.

I cannot figure out how to stop the server from sending these and any help would be greatly appreciated.

Thanks

Chris


#2

You setting a From: header? Set a from address and see if that solves it.


yerba# rm -rf /etc
yerba#


#3

I do have a From: header included but you got me to scutinize everything and it turns out I fixed it with this:

$mailheaders = "From: My website <name@domain.com>"; $mailheaders .= "\r\n"; $mailheaders .= "Reply-To: ".str_replace($unwanted,"",$email);instead of this

$mailheaders = "From: My website <name@domain.com>"; $mailheaders .= "Reply-To: ".str_replace($unwanted,"",$email);The new line(s), now it works fine. I tried to break it again with the new line(s) added to make sure that was the only problem and it seems like it is.

Thanks for the guidance

Chris


#4

That would cause the problem. get into the habit of adding the \n to the end of every header line. It’s required to spread the headers:
$mailheaders = “From: My Website name@domain.com\n”;

\r is optional. I’ve never used it myself, but others have mentioned problems when not using it. The only problem I see happening is windows servers/mail clients. Since now, I believe, only windows that uses \r today; Windows line breaks are “\r\n”. I think MacOS is on \n now; it use to be \r in MacOS9 and prior.


yerba# rm -rf /etc
yerba#