0

我需要使用 PHP 的mail()功能发送电子邮件。我正在使用的代码是这样的:

$email_message = chunk_split(base64_encode($email_message));
$headers = "Content-Transfer-Encoding: base64\r\n\r\n";
mail($to, $subject, $email_message, $headers);

电子邮件中有一个英镑符号未正确处理,即收件人收到的符号不正确。由于它与字符编码有关,我不确定如何设置它来告诉电子邮件客户端字符是如何编码的以及如何正确处理磅符号。这些信息可以放在标题中吗?

4

2 回答 2

4

您是否正确设置了电子邮件的编码?这是通过设置完成的

'内容类型:text/html; 字符集=utf-8'

在邮件的标题中。

如果向下滚动,这里有大量文档:http: //php.net/manual/en/function.mail.php

于 2013-02-14T16:04:58.233 回答
1

如果你有英镑符号出现,那么请看下面

$costsum = "£".$costsum;   (Does not work)
$costsum = "£".$costsum; (Does not work)
$costsum = "#163;".$costsum; (Does not work)

我找到的一个答案是这个!

$costsum = "\243".$costsum;

The \243 is a pound sign in whatever encoding that is. I tried all the pages with UTF-8 and that didn't work either. It was used to email a spreadsheet.

于 2013-12-16T11:52:32.110 回答