Why green checks in cPanel don't prove the mail passes
example.com, and asks a narrow question: did SPF pass for a domain that aligns with it, or did DKIM pass with a signature from a domain that aligns with it? If neither, DMARC fails, no matter how correct your records are.
SPF is the easy one to get wrong here, because SPF does not check the From header at all. It checks the envelope sender, also called the Return-Path or MAIL FROM. That is the address the sending server gives during the SMTP conversation, and the address bounces go back to. Recipients usually never see it. When WordPress sends mail through PHP's mail() function without setting that address, the server fills it in. On a cPanel server that default is often your cPanel username at the server's hostname, something like [email protected].
SPF then passes, but for example-host.net, not for your domain. Under a p=none policy nobody acts on that. Under quarantine or reject, it matters.
Read the headers of a failing message
Return-Path shows the envelope sender. Authentication-Results shows what the receiver concluded about SPF, DKIM, and DMARC.
Illustrative output format:
TEXT
Return-Path: <[email protected]>
From: Example Site <[email protected]>
Authentication-Results: mx.receiver.example;
spf=pass (sender IP is 203.0.113.10) smtp.mailfrom=server.example-host.net;
dkim=none;
dmarc=fail (p=REJECT) header.from=example.comsmtp.mailfrom names the domain SPF was evaluated for. header.from names the domain DMARC is protecting. Those two are different organizations, so SPF passing earns nothing. DKIM shows none here, so there is nothing to fall back on. The result is dmarc=fail, and the published policy tells the receiver to reject.
Your own message might show dkim=pass with a d= value that is not your domain, or no DKIM at all. Which domain cPanel signs with for locally submitted PHP mail depends on the server's Exim configuration, so check the d= tag in the DKIM-Signature header rather than assuming. If you want a deeper read of these fields, Reading Authentication-Results Headers to Fix DMARC Alignment covers them in more detail.
One nuance: DMARC alignment for SPF is relaxed by default, so a subdomain of your From domain still aligns. If a VPS uses a hostname like host.example.com and SPF authorizes it, the default envelope sender can align by luck. On shared hosting the hostname belongs to the provider, so it won't.
Confirm it on the server side
/var/log/exim_mainlog. Search for the recipient address you tested with:
BASH
# Read-only. Shows recent log lines mentioning the test recipient.
grep '[email protected]' /var/log/exim_mainlog | tail -n 20<=, which marks the message arriving. The address right after <= is the envelope sender Exim accepted. On PHP mail you will typically also see the local user and a local protocol rather than an authenticated SMTP login. If that sender is the cPanel username at the hostname, you have confirmed the root cause. If it is already an address on your domain, the problem is elsewhere, and the next section is where to look.
Without server access you can stop at the headers. They tell the same story from the receiving side.
Red herrings worth ruling out
include: mechanisms or the server IP won't help if SPF is being checked against the hostname domain instead of yours. You can't fix alignment from DNS when the envelope domain is wrong.
The DKIM key. Regenerating keys in cPanel does nothing if the message isn't being signed with your domain in the first place. Check the d= tag before touching keys.
The visitor's address in From. This one is a real cause, just a different one. Some form plugins put the person who filled in the form into the From header, so the notification claims to come from [email protected]. Your server can never align with someone else's domain, and that domain's own DMARC policy will fail it. The fix is to send From an address on your own domain and put the visitor's address in Reply-To, which most form plugins support as a separate field.
The DMARC record. Tightening the policy is what exposed the problem, but rolling it back only hides it. If you need to check what else is unaligned before enforcing again, What to Audit Before Switching DMARC Policy from None to Reject walks through it.
Fix the envelope sender
[email protected] or [email protected].
The first and usually more robust option is authenticated SMTP. Create a mailbox for site mail in cPanel, then configure an SMTP plugin in WordPress to log in to it over port 587 with STARTTLS or port 465 with TLS, using the mail server hostname shown in cPanel's mail client settings. Mail now enters Exim as an authenticated submission from a real mailbox. The envelope sender becomes that mailbox, SPF is evaluated for your domain, and DKIM signing for your domain is far more likely to apply. It also makes the mail traceable to a login, which helps when someone has to investigate later. Store the SMTP password the way the plugin recommends, ideally as a constant in wp-config.php rather than in the database.
The second option keeps PHP mail() but tells PHPMailer, the library behind wp_mail(), to set the envelope sender to the From address. WordPress core doesn't set it by default, which is why the server's default wins. A small must-use plugin does it:
PHP
<?php
// wp-content/mu-plugins/envelope-sender.php
// Set the envelope sender (Return-Path) to the From address so SPF
// is evaluated for your own domain instead of the server hostname.
// ponytail: assumes From is already an address on your domain;
// switch to authenticated SMTP if the server rewrites or rejects -f.
add_action( 'phpmailer_init', function ( $phpmailer ) {
phpmailer->Sender =phpmailer->From;
} );smtp.mailfrom=example.com (or a subdomain of it), ideally dkim=pass with d=example.com, and dmarc=pass. If you have log access, the <= line in exim_mainlog should now show your domain's address.
What to check first next time
smtp.mailfrom and the DKIM d= tag against header.from. If neither matches your domain, the fix belongs in WordPress, not DNS: send From a real mailbox on your domain, keep visitors in Reply-To, and either authenticate over SMTP or set the envelope sender explicitly. Then confirm with one more test message before calling it done.