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 [email protected]")

the "-f" sets the "From:", but that was already working by setting it in the 
$headers or in the php.ini

What's odd is that putting the -r parameter should also work from the php.ini 
settings but doesn't.

Thank you all!



On 12 déc. 2010, at 17:57, mouss wrote:

> Le 12/12/2010 16:24, R.A. Imhoff a écrit :
>> Thank you for your suggestions!
>> 
>> I did set the "From: " correctly, both in the php.ini and in the php code 
>> that calls mail(), but this only sets the "From:" and not the "Return-path:"
>> I agree that the message-id is not that important, but it would be nice if 
>> one could have the "Return-path:" reflect the same domain as "From:"
>> 
>> I have this in php.ini (the -r parameter is supposed to set the return-path, 
>> but seems to have no effect):
>> 
>>        sendmail_path = "sendmail -t -i -f [email protected] -r 
>> [email protected]"
>> 
>> and in the php code sending the mail, the headers are also set:
>> 
>>      $headers = 'From: me<  [email protected]>' . PHP_EOL .
>>        'Reply-To: me<  [email protected]>' . PHP_EOL .
>>        'X-Mailer: www.mydomain.com' ;
>>   ...
>>      $result = mail($to, $subject, $message, $headers);
> 
> 
> 
> $result = mail($to, $subject, $message, $headers, "-f [email protected]");
> 
> 
>> 
>> The outgoing mail does have the correct "From:" and "Reply-To:" headers, but 
>> the "Return-Path" stays as the hostname of the machine --
>> how else can one set the envelope sender ? (Putting a line with 
>> "Return-Path:<[email protected]>" in the $headers variable doesn't do it 
>> either -- it gets replaced in "cleanup")
>> 
>> 
>> 
>> On 12 déc. 2010, at 14:11, mouss wrote:
>> 
>>> Le 12/12/2010 12:15, R.A. Imhoff a écrit :
>>>> Hello,
>>>> 
>>>> I was wondering if anyone has succeeded to configure Postfix running on a 
>>>> server hosting multiple virtual domains such that outgoing mail to remote 
>>>> destinations get the "Return-Path" and the domain of the message-id match 
>>>> the "From:" header?
>>>> 
>>>> As it is, when sending mail, for example with a php call to mail(), the 
>>>> "Return path" and the domain of the message-id is always that of the 
>>>> hostname of the machine.
>>>> 
>>> 
>>> 
>>> - the return-path and the From: header are to be set by the sender.
>>> in your case, you should set it in your php code. put the full domain part 
>>> in the from address so that postfix doesn't "fix" it by appending $myorigin 
>>> or .$mydomain. see
>>>     http://www.postfix.org/ADDRESS_REWRITING_README.html
>>> and in particular
>>>     http://www.postfix.org/ADDRESS_REWRITING_README.html#standard
>>> 
>>> 
>>> - the message-id is also set by the sender (outlook, thunderbird, .. all 
>>> add one), and if it is not, postfix will add one. you can set the 
>>> message-id in php, but don't do that unless you know what you're doing.
>>> 
>>> but why do you want the message-id to contain the virtual domain? nobody 
>>> will be looking at the message-id (except software such as MUAs, ...).
>>> 
>>> 
>>> 
>>> 
>>>> (I'm running Postfix version 2.7.0 under Ubuntu 10.04)
>>>> 
>>>> Having searched the internet quite extensively on this question, it seems 
>>>> a number of others have attempted this, but I didn't find any solution ...
>>>> 
>>>> Many thanks for any help!
>>> 
>> 
> 

Reply via email to