相同的代码适用于其他电子邮件,只是额外的附件。然而,这个“相同”的电子邮件代码会生成一封电子邮件,Content-Type: text/html...
因此我可以看到电子邮件中显示的所有多部分边界或多部分/相关的 html 正文变成了附件并且电子邮件是空白的!
$emailHtml = "<h1>BLAH</h1>"
$emailTxt = "TEXT!"
$mime = new Mail_mime(array('eol'=>"\n"));
$mime->setHTMLBody($emailHtml, false);
$mime->setTxtBody($emailTxt, false);
$mime->headers(array(
'From' => '"me" <example@example.com>',
'Subject' => $subject
));
$mail =& Mail::factory('mail');
$mimeparams['text_encoding']="8bit";
$mimeparams['text_charset']="UTF-8";
$mimeparams['html_charset']="UTF-8";
$mimeparams['head_charset']="UTF-8";
$mail->send($email, $mime->headers(), $mime->get($mimeparams));