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

WordPress Trac noreply at wordpress.org
Fri Dec 5 12:33:53 UTC 2025


#49687: wp_mail() - Why is no envelope sender defined?
--------------------------------------------------+-----------------------
 Reporter:  vbbp                                  |       Owner:  SirLouen
     Type:  enhancement                           |      Status:  closed
 Priority:  normal                                |   Milestone:  6.9
Component:  Mail                                  |     Version:  5.4
 Severity:  major                                 |  Resolution:  fixed
 Keywords:  has-test-info has-patch has-dev-note  |     Focuses:
--------------------------------------------------+-----------------------

Comment (by jamieburchell):

 I should explain that my testing was with a vanilla PHP script (not
 WordPress) where I simply set the `sendmail_from` configuration directive
 and executed `mail('me at example.com', 'TEST', 'TEST')`. In this case, the
 `sendmail_from` configuration was ignored and likely why hosting
 environments that want to force it to something other than
 apache at machine_name (or similar) tack the `-f` parameter on to the
 `sendmail` bin path - since they cannot be sure what clients will actually
 be running on there.

 PHPMailer has this bit of code (curiously prefixed by a comment citing old
 PHP workarounds):


 {{{
 //PHP 5.6 workaround
 $sendmail_from_value = ini_get('sendmail_from');
 if (empty($this->Sender) && !empty($sendmail_from_value)) {
    //PHP config has a sender address we can use
    $this->Sender = ini_get('sendmail_from');
 }
 }}}

 So we can assume that this configuration directive would work if using
 PHPMailer.

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


More information about the wp-trac mailing list