views:

133

answers:

2

I've configured several headers in the mail() function, sender name and other fields appear as set. But, in the gmail mailed-by field, I see the hostname of my server, even though I've set the Mailed-By header to be different... Is there a way to change this, or am I specifying the wrong header to effect the change?

Current Headers:

From: [email protected]
Mailed-By: Example.com
X-Mailer: Example/1.0
+2  A: 

If you post the headers you are sending it will be easier to diagnose the issue. But the header should be "X-Mailer" to set the application mailed-by field, as far as I know. If that does not work, post your current headers and we can help you further / better.

EDIT:

Doing some further research, it seems the 5th parameter with the "-f" flag would be the way to do it:

mail($to, $message, $body, $headers, '[email protected]');

Is a possibility. That is generally an email address, so you would have to see what values it accepts etc. I found this information from the Joyent Discussion Board.

But reading that it may not be what you want.

-fname Sets the name of the from'' person (i.e., the sender of the mail). -f can only be used bytrusted'' users (normally root, daemon, and network) or if the person you are trying to become is the same as the person you are.

From the sendmail Man page. I will see if I cannot strum anything else up.

Brad F Jacobs
posted headers... i had assigned the x-mailer as the first thing, but added the mailed-by line on top to try overriding the gmail mailed-by. no go. :-(
ina
Updated with an option to test, the 5th parameter of sendmail, "-f"
Brad F Jacobs
+1  A: 

It sounds like that mailed-by header was added by your mail transfer agent, or gmail, after it left PHP. Sounds like it may be a security measure so abuse reports can be tracked down.

thomasrutter