我可以通过phpmailer和dkim发送带有通过结果的电子邮件。 但是如果存在AddAttachment文件, 我得到了:dkim = neutral(正文哈希未验证)
<?php
$message = "<html><head>
<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>
</head>
<body>
<table width='650' border='0' cellspacing='0' cellpadding='0'>
<tr>
<td class='style22' >TEST TEST</td>
</tr>
<td bgcolor='#0066FF' class='style22'>Description </td><td>SOME TEXT</td>
</tr>
</table></body></html>";
use PHPMailer\PHPMailer\PHPMailer;
require 'phpmailer6/vendor/autoload.php';
$file = "phpmailer6/1420069.pdf";
$mail = new PHPMailer(true);
$mail->setFrom('contact@mydomain.fr', 'First Last');
$mail->addAddress('paul25241@gmail.com', 'Paul');
$mail->Subject = 'PHPMailer mail() test';
$mail->msgHTML($message);
$mail->AddAttachment($file); // attachment
$mail->DKIM_domain = 'mydomain.fr';
$mail->DKIM_private = 'phpmailer6/private.key';
$mail->DKIM_selector = 'default';
$mail->DKIM_passphrase = '';
$mail->DKIM_identity = $mail->From;
if (!$mail->send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "YEAR !!! Message sent!";
}
?>
` 身份验证结果:mx.google.com; dkim = neutral(正文哈希未验证)