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 From | Risk | Recommended correction |
|---|---|---|
| `user@gmail.com` | Free-mail sender policy | Use `wordpress@example.com`; put user email in Reply-To. |
| `noreply@otherdomain.com` | Provider verification mismatch | Verify that domain or switch to the site domain. |
| `wordpress@example.com` without DKIM | Spam/filtering risk | Enable 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
- Send a plain `wp_mail()` test to a known-good mailbox.
- Check provider logs for acceptance or rejection.
- Then test the contact form or WooCommerce template.