【问题标题】:Using mail() to sent UTF8 e-mail使用 mail() 发送 UTF 8 电子邮件
【发布时间】:2013-06-12 13:30:48
【问题描述】:

我正在尝试使用 PHP 发送电子邮件,包括多语言字符。整个网站(html header、php header)都设置为UTF8以及form charset。

我现在拥有的 PHP 代码是:

$to = "email@email.com";
$subject = "Subject";
$message = "Question is ".$question;
$from = "auto@from.com";
$headers = "From:" . $from . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-UTF-8' . "\r\n";

$sendmail = @mail($to,$subject,$message,$headers);

我想我在某个地方错了?

我得到'?以带有日文字母的字符为例。

【问题讨论】:

    标签: php email utf-8


    【解决方案1】:
    $headers .= "MIME-Version: 1.0"."\r\n";
    $headers .= "Content-type: text/html; charset=utf-8"."\r\n";
    

    应该是你所需要的。

    我可能错了,但据我所知iso-UTF-8 不是一个有效的字符集,至少看起来不像。

    【讨论】:

      猜你喜欢
      • 2022-01-09
      • 1970-01-01
      • 2011-02-04
      • 1970-01-01
      • 2011-08-20
      • 2023-04-08
      • 2012-04-08
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多