|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
From: R.A. Imhoff (lists
flashgenie.net)
Date: Sun Dec 12 2010 - 11:45:30 CST
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
This is interesting: in testing this on the server in question, the "-f" does nothing (with a lowercase -f).
In an older sendmail man page I just came across it says "... -f can only be used by trusted users (normally root, daemon, and network) or if the person you are trying to become is the same as the person you are."
So I guess my php code doesn't get permission to use it. (The current man page doesn't have that ...)
"-r" sets the Return-Path and the From if there is no From in the $headers set in the php code, otherwise the -r sets only the Return-Path.
So what works for my setup is:
$headers = 'Reply-To: ri <reply-me
mydomain.net >' . PHP_EOL . 'From: ri <from-me
mydomain.net >' ;
$subject ="some subject";
$message = 'some text';
$to = "some one <someone
some.com>";
$done = mail($to, $subject, $message, $headers, '-r return-me
mydomain.net');
The message then arrives with the different addresses as expected:
Return-Path: <return-me
mydomain.net>
To: some one <someone
some.com>
Subject: some subject
Reply-To: ri <reply-me
mydomain.net>
From: ri <from-me
mydomain.net>
And it does go via Postfix, from the Log:
Dec 12 18:24:34 machine-domain postfix/qmgr[2578]: CF99E10119: from=<return-me
mydomain.net>, size=427, nrcpt=1 (queue active)
Dec 12 18:24:36 machine-domain postfix/smtp[12071]: CF99E10119: to=<someone
some.com>, ...
On 12 déc. 2010, at 18:20, Wietse Venema wrote:
> R.A. Imhoff:
>> In fact what finally does set the Return-path is to use the "-r" parameter in the 5th place:
>>
>> $result = mail($to, $subject, $message, $headers, "-r me
example.com")
>>
>> the "-f" sets the "From:", but that was already working by setting it in the $headers or in the php.ini
>
> No, that is incorrect.
>
> With POSTFIX, the -f and -r options do exactly the same thing:
>
> case 'f':
> sender = optarg;
> break;
> ...
> case 'r': /* obsoleted by -f */
> sender = optarg;
> break;
>
> If you look in your logging, you may find that you are handing the
> mail to something other than POSTFIX.
>
> POSTFIX submissions looks like:
>
> pickup[xx]: yyy: uid=1001 from=<wietse>
> cleanup[zz] yyy: message-id=<20101212060507.979E51F3EA6
spike.porcupine.org>
>
> Wietse
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]