WordPress core sends a dozen notification emails out of the box — password resets, new user registration, new comment, comment moderation, admin email change, password change. All of them ship as plain text, all of them say “[Your Site] something happened,” and all of them come from wordpress@example.com. For a brand-conscious site, this is a visible gap. The customization itself is straightforward; the trap is that the wrong approach makes future WordPress upgrades painful.
What’s happening
Each WordPress notification email is built in core PHP via functions like wp_new_user_notification(), retrieve_password(), and wp_notify_postauthor(). Each one runs the subject, message, and headers through filters before sending. Three filters cover most of what brands want to customize:
wp_mail_from— overrides the From email address globally.wp_mail_from_name— overrides the From display name globally.wp_mail_content_type— switchestext/plaintotext/htmlso the body can be rendered as HTML.
Then there are message-specific filters: retrieve_password_message, wp_new_user_notification_email, comment_notification_text, etc. Each one lets you rewrite the template for that specific notification without touching core.
The trap: directly modifying core files or copying entire pluggable functions (wp_mail, wp_password_change_notification) into a theme functions.php makes future WordPress upgrades fragile. The right pattern is to use the filters, branded templates, and a mu-plugin so the customization is portable across themes.
How to verify
Inspect what’s currently active:
wp eval 'print_r( apply_filters("wp_mail_from", "test@example.com") );'
wp eval 'print_r( apply_filters("wp_mail_from_name", "WordPress") );'
wp option get admin_email
Trigger a notification (force a password reset for a test user) and inspect the headers of the received message. The From, Reply-To, and Content-Type tell you which filters are firing.
The fix
-
Set From globally via a mu-plugin. Drop
wp-content/mu-plugins/00-mail-branding.php:<?php add_filter('wp_mail_from', fn($e) => 'noreply@example.com'); add_filter('wp_mail_from_name', fn($n) => 'Example Brand'); add_filter('wp_mail_content_type', fn() => 'text/html');The
00-prefix loads it before other mu-plugins, so anything that overrides later takes precedence intentionally. -
Brand individual notifications via their specific filters. For password reset:
add_filter('retrieve_password_message', function($message, $key, $user_login, $user_data) { $reset_url = add_query_arg(['action'=>'rp','key'=>$key,'login'=>rawurlencode($user_login)], wp_login_url()); ob_start(); include WP_CONTENT_DIR . '/themes/example/email-templates/password-reset.php'; return ob_get_clean(); }, 10, 4);The template file renders the HTML — header, brand colors, the reset link, footer with unsubscribe and physical address (legal requirement in most jurisdictions for marketing-adjacent mail).
-
Use a base HTML template, not full HTML per notification. A wrapper template that takes a content block keeps the branding consistent across all messages. Cache the wrapper output if rendering is expensive.
-
Always include a plain-text alternative. Receivers penalize HTML-only messages. PHPMailer’s
AltBodyis set via thephpmailer_initaction:add_action('phpmailer_init', function($mailer) { if (empty($mailer->AltBody) && !empty($mailer->Body)) { $mailer->AltBody = wp_strip_all_tags($mailer->Body); } }); -
Test every notification path before declaring done. Password reset, new user, password change, comment notification, admin email change, WooCommerce order confirmation if applicable. The pluggable-function path each takes is different.
-
Keep customization in mu-plugins or a custom plugin, not the theme. A theme switch should not break your transactional email branding. On Enterprise WordPress sites we ship the branding as a versioned mu-plugin so it travels with the site, not the theme.
Stack Harbor ships transactional email branding as part of Enterprise WordPress launches — the wrapper template, the per-notification overrides, and the plain-text fallback. If your password-reset emails still say “Your Site” and come from wordpress@, we can do the branding pass.