Although it is true that adding the WP-MAIL-SMTP plugin does help here, I would like to keep the number of plugins to a minimum.
Therefore, I did some debugging and I found the reason that WooCommerce is causing DMARC to fail.
It is because of a disagreement in the header caused by WooCommerce failing to set the PHP Mailer $mail->Hostname to match the hostname of the site.
Because $mail->Hostname is not being set, the default handling is to call gethostname(), which will be the hostname of the server, which often will not match the hostname of the WP site / e-mail domain.
So we need:
$mail->Hostname=’example.com’;
Additionally, the envelope-sender does not match the e-mail address set in the WooCommerce e-mail settings. For that, an additional parameters is needed:
$mail->Sender=’[email protected]’;
I discovered this because the Wordfence plugin on the same site is able to send mail just fine and when I compare the headers from Wordfence, vs. WooCommerce, the problem is clear.
Here is a subset of the bad headers from WooCommerce, due to not setting the $mail->Hostname to the hostname of the WP site (redacted).
Pay attention to smtp.mailfrom and envelope-sender.
In the bad WooCommerce example, the smtp.mailfrom is the hostname of the host, not the hostname of the WP site.
ARC-Authentication-Results: i=1; inbound10.ore.mailhop.org;
spf=none smtp.mailfrom=giowmXXXX.siteground.biz smtp.remote-ip=NNN.NNN.NNN.NNN;
dkim=permerror header.d=signing.refused header.s=default header.a=rsa-sha256 header.b=Ef8g4aPy;
dmarc=fail header.from=example.com;
arc=none header.oldest-pass=0;`
Envelope-Sender: [email protected]
Whereas in a working example (from Wordfence through same site without a special SMTP plugin), we see:
ARC-Authentication-Results: i=1; inbound10.ore.mailhop.org;
spf=pass smtp.mailfrom=example.com smtp.remote-ip=NNN.NNN.NNN.NNN;
dkim=pass header.d=example.com header.s=default header.a=rsa-sha256 header.b=Cl39Dlei;
dmarc=pass header.from=example.com;
arc=none header.oldest-pass=0;
Envelope-Sender: [email protected]
If WooCommerce would make those two minor changes, then we could eliminate the need for yet another plugin.
Really, if this could be the default behavior of WordPress in general it would probably solve a multitude of problems for a lot of people.
-
This reply was modified 3 years, 3 months ago by
aetherscythe.