I run Ubuntu 10.04 and installed a LAMP stack with a "satellite" Postfix (used as a relay for my ISP's smtp).
In php.ini, I kept the sendmail pass to default so with -t -i
arguments:
;sendmail_path =
I send emails like this:
$headers = 'From: [email protected]' . "\r\n";
$headers .= 'Reply-To: [email protected]' . "\r\n";
$headers .= 'Return-Path: [email protected]';
mail('[email protected]', 'Email title', 'Text of the body.', $headers);
The emails recieved have this in the body (It should be in the header):
Reply-To: [email protected]
Message-Id: <[email protected]>
Date: Thu, 27 Oct 2011 23:02:18 +0200 (CEST)
How can we fix that?
Note: The emails are working properly on other installs: Gentoo with qmail or Windows with smtp set to my isp's in the php.ini.
Here is the full header:
Return-Path: <[email protected]>
Delivered-To: [email protected]
Received: (qmail 28922 invoked from network); 27 Oct 2011 23:00:55 +0200
Received: from zhhdzmsp-mail12.myisp.com (1.2.3.5)
by www.mydomain.com with SMTP; 27 Oct 2011 23:00:55 +0200
Return-Path: <[email protected]>
X-FXIT-IP: IPv4[1.2.3.4] Epoch[1319888334]
Received: from [1.2.3.4] ([1.2.3.4:17957] helo=dev.mydomain.com)
by zhhdzmsp-mail12.myisp.com (envelope-from <[email protected]>)
(ecelerity 2.2.3.46 r()) with ESMTP
id 6E/C0-28209-6D6C9AE4; Thu, 27 Oct 2011 21:02:14 +0000
Received: by dev.mydomain.com (Postfix, from userid 33)
id 6F32440DE7; Thu, 27 Oct 2011 23:02:18 +0200 (CEST)
To: [email protected]
Subject: Email Title
X-PHP-Originating-Script: 1000:helpdesk.php
From: [email protected]
Postfix translates "line feed" (\n) into "carriage-return line-feed" (\r\n). Try removing the \r and using just \n.
Your statements and the header don't match. Probably just a copy&paste error but is a bad starting point for diagnosis.
Then you have two Return-Path lines in the header and one in the body. THAT is strange and an indication for a bigger problem.
The overall problem is that you are trying to identify a problem with a header of a mail that went through four(!) email servers. And you then blame one of them as the culprit. But it can be any of them. Or most obvious none of the five as mail servers in general don't modify headers or bodies, except they are told to or required by RFC 5321. So if you want to analyze the problem you have to look how the mail arrives at the first server and not at the upcoming servers.