我正在使用以下代码发送多部分/替代 HTML 和纯文本电子邮件。这些电子邮件发送精美的内容,但其中一些被垃圾邮件过滤器捕获。这是我正在使用的代码。
$notice_text = "This is a multi-part message in MIME format.";
$plain_text = "Some Plain Text Here\n\n";
$html_text = '<html><head><title>Sample HTML Email</title></head><body>';
$html_text .= '<p>Some text will go here.</p>';
$html_text .= '<p><img src="http://www.mydomain.com/img/offers.jpg" /></p>';
$html_text .= '<p>Can\'t see the images? <a href="http://www.mydomain.com/print_offer.php?promo=' . $promo_code . '">Click here</a></p>';
$html_text .= '</body></html>';
$semi_rand = md5(time());
$mime_boundary = "==MULTIPART_BOUNDARY_$semi_rand";
$mime_boundary_header = chr(34) . $mime_boundary . chr(34);
$from = "Test Email <testemail@testemail.com>";
$subject = "Get Your Offers Here";
$body = "$notice_text
--$mime_boundary
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
$plain_text
--$mime_boundary
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
$html_text
--$mime_boundary--";
mail($email, $subject, $body,
"From: " . $from . "\n" .
"bcc: " . $bcc . "\n" .
"MIME-Version: 1.0\n" .
"Content-Type: multipart/alternative;\n" .
" boundary=" . $mime_boundary_header);
是什么导致它进入垃圾邮件过滤器?当我以纯文本形式发送电子邮件时,他们会顺利通过,只有当我发送 HTML 电子邮件时,他们才会被抓住。任何帮助,将不胜感激。是否有更多我可以添加到标题以帮助防止垃圾邮件过滤器?