PHPMailer.php
From A2Wiki
Regarding the instruction to use the "-f" parameter when sending mail from a PHP script:
"Make sure you properly set a proper envelope sender using the '-f'
parameter with the php mail() command or with sendmail."
Because I am using the PHPMailer.php class to deliver my emails I wasn't
sure at first what was meant. I searched inside the class and found
references to -f, which sets the sender.
If using Sendmail:
function SendmailSend($header, $body) {
if ($this->Sender != "")
$sendmail = sprintf("%s -oi *-f *%s -t", $this->Sendmail,
$this->Sender);
else
$sendmail = sprintf("%s -oi -t", $this->Sendmail);
And if using Mail:
function MailSend($header, $body) {
...
if ($this->Sender != "" && ...
{
...
ini_set("sendmail_from", $this->Sender);
$params = sprintf("-oi -f %s", $this->Sender);
...
}
Basically, you want $this->Sender to be set.
The result will be that the Return-path in the email source should be explicitly set so that it doesn't default to "nobody" at the web host.
i.e. not
Return-path: ** Envelope-to: test_recipient3@p-s.co.nz Delivery-date: Tue, 12 Sep 2006 17:38:13 -0400 Received: from [209.124.50.10] (helo=a2s5.a2hosting.com) by a2s2.a2hosting.com with esmtps (TLSv1:AES256-SHA:256) (Exim 4.52) id 1GNFxG-00048i-Dw for test_recipient3@p-s.co.nz; Tue, 12 Sep 2006 17:38:06 -0400 Received: from nobody by a2s5.a2hosting.com with local (Exim 4.52) id 1GNFxD-0002ju-P2 for test_recipient3@p-s.co.nz; Tue, 12 Sep 2006 17:38:03 -0400 Date: Tue, 12 Sep 2006 17:38:03 -0400 To: Test recipient 3 From: Grant testing SODA Reply-to: Grant testing SODA Subject: This is a test survey link
but
Return-path: ** Envelope-to: test_recipient7@p-s.co.nz Delivery-date: Tue, 12 Sep 2006 17:57:26 -0400 Received: from [209.124.50.10] (helo=a2s5.a2hosting.com) by a2s2.a2hosting.com with esmtps (TLSv1:AES256-SHA:256) (Exim 4.52) id 1GNGFj-00059C-21 for test_recipient7@p-s.co.nz; Tue, 12 Sep 2006 17:57:11 -0400 Received: from nobody by a2s5.a2hosting.com with local (Exim 4.52) id 1GNGFg-0000t5-Bb for test_recipient7@p-s.co.nz; Tue, 12 Sep 2006 17:57:08 -0400 Date: Tue, 12 Sep 2006 17:57:08 -0400 To: Test recipient 7 From: Grant testing SODA Reply-to: Grant testing SODA Subject: This is a test survey link
