我接手了一份脚本,它可以用三种语言(都是相同的内容-重复)发送一些内容,但是当接收到内容时,字符会断开,我认为这是UTF-8问题。
我只需要将charset部分更改为utf-8,还是其他任何东西都需要更改,比如7bit部分?
你可以看到我插入了一个UTF-8参考(尚未测试)
这里有一个网址http://bitprison.net/php_mail_utf-8_subject_and_message,似乎涉及到基础编码,但我不确定我是否需要在这里使用它?
// Contruct message body.
$body = "";
// Add message for non-mime clients.
$body .= "This is a multi-part message in MIME format.\n";
// Add text body.
$body .= "\n--$boundary\nContent-Type: text/plain; charset=UTF-8; format=flowed\nContent-Transfer-Encoding: 7bit\n\n" . $textContent;
// Add HTML body.
$body .= "\n--$boundary\nContent-Type: text/html; charset=ISO-8859-1; format=flowed\nContent-Transfer-Encoding: 7bit\n\n" . $htmlContent;
mail( $row["email"], "Update Your ArtsDB Listing", $body, $headers );
我在这里找到了一个示例来帮助你。
$body .= "\n--$boundary\nContent-Type: text/plain; charset=UTF-8; format=flowed\nContent-Transfer-Encoding: 8bit\n\n" . $textContent;
// Add HTML body.
$body .= "\n--$boundary\nContent-Type: text/html; charset=UTF-8; format=flowed\nContent-Transfer-Encoding: 8bit\n\n" . $htmlContent;