0

我正在使用 phpmailer 通过电子邮件向自己发送通知。
电子邮件采用 html 格式,正文包含希伯来语字符。

在我的 Mac 上,电子邮件看起来不错,但在 iphone 上却显示为乱码。

我尝试了所有可能的编码头组合在 html 头标签上和作为 phpmailer 的属性,但没有运气。

有任何想法吗?

谢谢

我如何格式化代码?

require("./classes/phpmailer/class.phpmailer.php");

$mailer = new PHPMailer();
$mailer->IsSMTP();
$mailer->Host = 'ssl://smtp.gmail.com:465';
$mailer->SMTPAuth = TRUE;
$mailer->Username = 'bla@gmail.com'; // Change this to your gmail adress
$mailer->Password = '1234'; // Change this to your gmail password
$mailer->From = 'joe@gmail.com'; // This HAVE TO be your gmail adress
$mailer->FromName = 'Mail'; // This is the from name in the email, you can put anything you like here
$mailer->IsHTML(true);
$mailer->Body = $message;
$mailer->Subject = $subject;

$mailer->AddAddress('me@gmail.com'); // This is where you put the email adress of the person you want to mail if ($mailer->Send()) echo "ok";
else echo "no ok";

4

2 回答 2

0

确保您的电子邮件以 UTF-8 格式发送,并带有正确的标头和元标记,以便在发送 unicode 电子邮件时获得最佳效果。如果您没有明确指定要发送 UTF-8,则中间和接收邮件服务器可以自由地对消息的字符集和编码做出假设。

于 2010-09-10T18:44:25.270 回答
0

我建议您在脚本之上添加一个验证,以检查客户端浏览器/操作系统,如果 OS=iphone 则以对 iphone 友好的格式优化您的 $message。

于 2010-11-01T03:14:20.090 回答