0PHP sendmail的失败DMARC

我跑 VPS 哪些主机多个域. 从这些域发送邮件一直是棘手的. 我一直使用 WP SMTP 邮件WordPress插件来解决此, 但我希望得到一个适当的修复. 经过大量阅读后,我找到了合适的解决方案

The prob­lem is that the “from” address and the “return to” address have to match and unless you know how to fully do the code they wont.


$发件人= 'you@yourdomain.com';
$标题=“从: “ . $寄件人 . "\[R  n" . '回复: “ . $寄件人 . "\[R  n" . “返回路径: “ . $寄件人;
$成功=邮件('recepient @邮件', $学科, $信息, $头, "-f " . $寄件人);

注, 关键的部分是最后一部分, the extra value AFTER the head­ers. This is the extra para­met­ers part and we spe­cify the sender again with a ‑f command

For more info on this there is a good art­icle at Pupun­zi


Simply add the fol­low­ing code to your theme’s functions.php or cre­ate a cus­tom plu­gin with the code

类email_return_path {
   功能__construct() {
  ADD_ACTION( 'phpmailer_init', 排列( $这, '固定' ) );   

功能修复( $PHPMailer的 ) {
    $phpmailer->Sender = $phpmailer->From;

由于 Kin­amo 用于顶端

你怎么看? 请给我们一个评论如下! 如果您想订阅,请使用菜单上的订阅链接右上方. 您还可以通过使用下面的链接社会分享这与你的朋友. 干杯.