[wp-trac] [WordPress Trac] #49687: wp_mail() - Why is no envelope sender defined?

WordPress Trac noreply at wordpress.org
Mon Mar 23 23:15:14 UTC 2020


#49687: wp_mail() - Why is no envelope sender defined?
--------------------------+------------------------------------------------
 Reporter:  vbbp          |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Mail          |    Version:  trunk
 Severity:  minor         |   Keywords:  2nd-opinion has-patch dev-feedback
  Focuses:                |
--------------------------+------------------------------------------------
 As just figured out, some (mail) servers require the envelope sender to be
 set in order to accept outgoing emails.

 For the PHP built-in mail() function
 (https://www.php.net/manual/en/function.mail.php) this can be done using
 the additional parameter (e.g. "-fwebmaster at example.com) as explained in
 example 4 of the PHP manual page.

 In order to use that option and set the envelope sender in PHPmailer
 either the sender attribute of the phpmailer object needs to be set
 ($phpmailer->Sender = "sender at example.com") or when using the setFrom()
 method of PHPmailer, the 3rd parameter needs to be set to true (=default).

 Unfortunately, the current implementation of wp_mail() explicitly sets
 that 3rd parameter to false, which prevents the envelope sender from being
 set (see https://core.trac.wordpress.org/browser/trunk/src/wp-
 includes/pluggable.php?rev=47494#L358).

 Is there any reason for doing so and could we change L358 to

 $phpmailer->setFrom( $from_email, $from_name, true );

 ?

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/49687>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list