Reputation: 21
I am trying to send mail using PHP mail function and sendmail on RHEL. There is a line in the header, Received: (from apache@localhost), which is causing some recipients to drop the message. I need to get this portion of the header replaced with a proper user/domain: (lets say [email protected]). I have been fighting with this for a while, I am just not sure what to do. Discussions are just all over the place on the web. The scripts do specify the sender.
Here is an example of the SMTP header:
Received: from <omitted> (<omitted> [127.0.0.1])
by <omitted> (8.14.4/8.14.4) with ESMTP id rADEwvp4003653
for <omitted>; Wed, 13 Nov 2013 09:58:57 -0500
Received: (from apache@localhost)
by <omitted> (8.14.4/8.14.4/Submit) id rADEwvEj003650;
Wed, 13 Nov 2013 09:58:57 -0500
Date: Wed, 13 Nov 2013 09:58:57 -0500
Message-Id: <omitted>
To: <omitted>
Subject: <omitted>
From: [email protected]
Reply-To: [email protected]
Upvotes: 0
Views: 2131
Reputation: 5755
if you use standard mail()
function there is a hidden parameter , try to pass "-fuser@domain" as fifth parameter
link
Upvotes: 1
Reputation: 1776
Pass somethings like this as fourth parameter. It should be enough to change From field, but will not protect your mails from SPAM folder because it requires more complcated stuff like SPF records and DKIM keys.
$headers = 'From: [email protected]' . "\r\n" .
'Reply-To: [email protected]' . "\r\n";
Upvotes: 0