[wp-trac] [WordPress Trac] #49687: wp_mail() - Why is no envelope sender defined?
WordPress Trac
noreply at wordpress.org
Fri Dec 5 10:18:00 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 SirLouen):
Replying to [comment:48 jamieburchell]:
> `sendmail_from` is a Windows only configuration option. Hence the need
to add `-f` to the sendmail path in Linux:
>
> > sendmail_from string
> > Which "From:" mail address should be used in mail sent directly via
SMTP (Windows only). This directive also sets the "Return-Path:" header.
I have to admit that this is very poorly explained and can easily lead to
confusion; this is why some people don't use it correctly.
As you can see, there are two parts:
1. `Which "From:" mail address should be used in mail sent directly via
SMTP (Windows only)`
2. `This directive also sets the "Return-Path:" header.`
There are some specific SMTP mailing functions for enabling Windows hosts
such as `SMTP` and `smtp_port`. With `sendmail_from` you can set the
`from` field for such.
But, the real utility of `sendmail_from` was to send the `Return-Path`
header which MDA use to set the Sender envelope.
Yesterday my first thought was the idea provided by @siliconforks of
simply removing the `Sender` parameter in phpmailer.
Replying to [comment:49 siliconforks]:
> If anyone is running WordPress 6.9 and wants to revert to exactly the
way it behaved in WordPress 6.8, I believe that the following code should
work:
>
> {{{#!php
> <?php
> add_action( 'phpmailer_init', static function ( $phpmailer ) {
> $phpmailer->Sender = '';
> } );
> }}}
This may only work in the scenario that there are no two conflicting
`Sender` addresses, but the fact that the user actually doesn't have the
default route for `sendmail` binary configured correctly in `php.ini`. But
this is a flawed workaround, since the server is poorly configured and we
are leaving it like that. Ideally in this scenario, the server should be
correctly configured, and if we want to force the `-f` the use
`isSendMail`. But if the host owner is not willing to update, then this
could be a good idea to try.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/49687#comment:50>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list