0

所以我有脚本发送纯文本和 html 的多部分电子邮件,由于某种原因纯文本版本不起作用,但是当我在 gmail 中显示原始内容时,我可以看到它正在发送。当我单击消息乱码时,它只显示html?

// headers
$headers = "MIME-Version: 1.0\r\n";
$headers .= 'From: From Name  <'. FROM_EMAIL. ">\r\n";
$headers .= 'To: '.$member->member_info['memem']. "\r\n";
$headers .= 'Bcc: receipts@gmail.com' . "\r\n";
$headers .= "Subject: Registration Receipt\r\n";
$headers .= "Content-Type: multipart/alternative;boundary=" . $boundary . "\r\n";


// Additional headers
 $message . "\r\n\r\n--" . $boundary . "\r\n";
 $message .= "Content-type: text/plain;charset=utf-8\r\n\r\n";

 $message .= $receipt_txt;//plain text

 $message .= "\r\n\r\n--" . $boundary . "\r\n";
 $message .= "Content-type: text/html;charset=utf-8\r\n\r\n";

 $message .= $receipt_html;//html

 $message .= "\r\n\r\n--" . $boundary . "--";




mail( $member->member_info['memem'], 'Registration Receipt', $message, $headers );
4

1 回答 1

0

废话。我找到了。"$message . "\r\n\r\n--" . $boundary . "\r\n";" 应该是 "$message .= "\r\n\r\n--" . $boundary . "\r\n";" 我觉得很笨:(

于 2013-07-31T13:26:15.977 回答