[wp-trac] [WordPress Trac] #14888: PHPMailer class uses wrong/no sender for mail envelope

WordPress Trac wp-trac at lists.automattic.com
Fri Sep 17 07:50:38 UTC 2010


#14888: PHPMailer class uses wrong/no sender for mail envelope
--------------------------+-------------------------------------------------
 Reporter:  gkusardi      |       Owner:                 
     Type:  defect (bug)  |      Status:  new            
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Mail          |     Version:  3.0            
 Severity:  normal        |    Keywords:                 
--------------------------+-------------------------------------------------
 As an result following SMTP envelope and "Return-Path" email address can
 occur:

 {{{apache at localhost.localdomain}}}

 This will lead some mail servers to reject mails because of the not valid
 fqdn "localhost.localdomain".

 Correctly the defined FROM address should be used, usually:

 {{{'wordpress@'.$_SERVER['SERVER_NAME']}}}

 In PHPMailer::CreateHeader() it is checked for

 {{{if($this->Sender == '')}}}

 The following will set the "Return-Path" in the mail headers, but NOT the
 envelope email address used in the SMTP handshake:

 {{{$result .= $this->HeaderLine('Return-Path', trim($this->From));}}}

 I fixed it by adding the following line after the mentioned one, setting
 the "Return-Path" in the mail header:
 {{{$this->Sender = $this->From;}}}

 So my condition looks like:
 {{{
     if($this->Sender == '') {
       $result .= $this->HeaderLine('Return-Path', trim($this->From));
       $this->Sender = $this->From;
     } else {
       $result .= $this->HeaderLine('Return-Path', trim($this->Sender));
     }
 }}}

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/14888>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list