WordPress sender fix

Fix WordPress wp_mail From address and DMARC alignment.

WordPress mail often fails or lands in spam when the From address uses Gmail, Yahoo, Outlook, or a domain that is not verified with the sending provider.

Sender alignment matrix

Current FromRiskRecommended correction
`user@gmail.com`Free-mail sender policyUse `wordpress@example.com`; put user email in Reply-To.
`noreply@otherdomain.com`Provider verification mismatchVerify that domain or switch to the site domain.
`wordpress@example.com` without DKIMSpam/filtering riskEnable provider DKIM/SPF for the sending domain.

Safe WordPress filter pattern

// Pattern to verify in your environment.
add_filter('wp_mail_from', function () {
    return 'wordpress@example.com';
});

add_filter('wp_mail_from_name', function () {
    return 'Example Website';
});

Testing workflow

  1. Send a plain `wp_mail()` test to a known-good mailbox.
  2. Check provider logs for acceptance or rejection.
  3. Then test the contact form or WooCommerce template.