wp-mail-from is a must-use WordPress plugin that sets a real From address, From name and envelope sender on every wp_mail() message. It is for site operators whose notifications leave from wordpress@ and whose bounces go nowhere. The code is at https://github.com/IndianOpinion/wp-mail-from, under the MIT licence, and v0.1.0 was released on 12 November 2026.
It never sends mail itself, never opens a connection and never replaces wp_mail(). We wrote it from scratch. It is independent of and not affiliated with any third-party plugin it integrates with.
Out of the box, WordPress sends every message as wordpress@<your domain> with the display name “WordPress”. On almost every site that mailbox does not exist. Two things follow.
We have no delivery figures to offer. The usual answers are a ten-line wp_mail_from filter that gets some cases wrong, or a full SMTP plugin that does far more than this job.
MAIL FROM and the Return-Path the receiver records.respect (the default), align and override.wp-config.php, then a per-site option, then a network option on multisite, then a derived default.show, set and reset.Inside one wp_mail() call:
wp_mail filter at priority 1000, the plugin reads the headers the way core will: string or array, CRLF or LF, any case, last From wins. It resolves the identity and decides. The arguments are returned unchanged.pre_wp_mail, if another plugin short-circuits the message, the plugin’s state is dropped.wp_mail_from and wp_mail_from_name at priority 5, the decision is applied. It runs early, so later code, including an SMTP plugin’s forced From, still wins.phpmailer_init at priority 999, Reply-To and the envelope sender are set, the wpmf_decision action fires and, in dry run, one log line is written.wp_mail_succeeded or wp_mail_failed, state is dropped and a failure is logged.The modes, in short: respect keeps any explicit From. align keeps one on your domain and replaces one on another domain with your identity. override replaces all, and in both of the replacing modes the original address moves to Reply-To.
WordPress reuses one PHPMailer object for every message in a request and never resets its Sender. The plugin remembers the value it set and treats it as empty on the next message, so a sender from message one never leaks into message two. It never adds a Return-Path header, because receiving servers set that from the envelope.
The quick start from the README:
define( 'WPMF_FROM', '[email protected]' );
define( 'WPMF_FROM_NAME', 'Example News' );
wp mail-from show
wp mail-from show --message-from="Visitor <[email protected]>"
is_email(), has no line breaks, is at most 254 characters, has a domain with a dot and is not an IP literal. Names lose control characters and are capped at 255 characters. Filter results go through the same checks.defer mode wins on From. stand-aside changes nothing and only reports.The reviewer’s comment lists these fixes before the merge, each with a test:
settings_errors() prints messages as HTML, and the site settings error quoted the rejected input unescaped. The message is now escaped first.locked list with the ticked boxes, so a lock on a field with no box on the screen was lost. Off-screen locks are now kept.wp mail-from set now warns when the network has locked the field, since the site value is then ignored.wp_mail(), through direct PHPMailer use, PHP mail() or external APIs, is not touched.wp_mail() may ignore the From filters. The plugin reports it but cannot change it.co.uk site an address at co.uk would count as aligned.respect mode, a kept visitor From also becomes the envelope sender when none is set, as the PRD says. With the PHP mail() transport that sends bounces to the visitor. A later release may fall back to the configured address for the sender.wp mail-from reset --yes step to run before removing the files.Test status: this is v0.1.0, tested on stubs and mocks. At review, 131 tests passed with PHPStan level 8 and phpcs clean. They ran against stubs, not a live WordPress, and the readme file’s “Tested up to” line has not been confirmed on a real install. CI has not yet run on GitHub, because the token lacked the scope to push it. There are no open issues.
The package is not on Packagist yet, so first add a Composer vcs repository entry for https://github.com/IndianOpinion/wp-mail-from.
composer require indianopinion/wp-mail-from
It needs WordPress 6.4 or later and PHP 8.1 or later, on a single site or multisite. The package type is wordpress-muplugin. For a must-use install, put the plugin directory in wp-content/mu-plugins/ and copy the one-file loader from mu-loader/ next to it. It also works as a normal plugin from the release zip.