Forum Moderators: coopster

Message Too Old, No Replies

How to set "Return-Path" in mail

         

groovyhippo

7:32 pm on Jun 4, 2003 (gmt 0)

10+ Year Member



I am using PHP's mail function, but cannot seem to set the "Return-Path" header. This is what I am doing:

$headers = "Return-Path: <me@mydomain.com>\r\n";
$headers .= "From:Me <me@mydomain.com>\r\n";
$headers .= "Reply-To: Me <me@mydomain.com>\r\n";
$headers .= "X-Mailer: My Mailer\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/plain\r\n\r\n";
mail ($to, $subject, $body, $headers);

But when the emails get delivered, the Return-Path header is set to: apache@serverhostname.mydomain.net

All other headers are set correctly.

Where am I going wrong?

jatar_k

7:44 pm on Jun 4, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



I believe I use ini_set [php.net]("sendmail_from","me@mydomain.com")

it is hard set in the php.ini sendmail_from

groovyhippo

7:59 pm on Jun 4, 2003 (gmt 0)

10+ Year Member



Just tried that, but it still didn't make any difference.

groovyhippo

9:34 am on Jun 5, 2003 (gmt 0)

10+ Year Member



jatar_k - are you running your scripts on a Win32 system or a linux one?

jatar_k

1:53 pm on Jun 5, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



the scripts I have put that in were all on linux are you on Win32 then?

groovyhippo

2:16 pm on Jun 5, 2003 (gmt 0)

10+ Year Member



No, I'm on linux too, but I read something that seemed to suggest the sendmail_from was for Win32 only. Think that was a red-herring though.

I have actually sorted the problem now. In the end, I edited sendmail.cf to treat apache as a 'trusted user' and then created a file in the httpd/conf folder to give the sendmail_from and sendmail_path new values. It means it's set for the entire site rather than for individual scripts, but it will do me.

Thanks for your help.