我正在为我的项目使用 codeignator 框架。发送时电子邮件中缺少一些日语字符。我检查了控制器并且所有字符都存在。我检查了配置、电子邮件字符集,发现它是 utf-8。我还添加了这个“header('Content-Type: text/html;charset=utf-8');” . 同样,从同一项目发送的邮件也没有问题,仅此特定电子邮件存在问题。
公共功能电子邮件(){
if($this->lan == "en"){
$site_name = "xyz.com";
$fromname = "xyz.com";
$subject = 'sub 【'.$site_name.'】';
$content = " Content of email from ".$site_name."<br /><br />";
}else{
$site_name = "japanesename.com";
$fromname = "japanesename.com";
header('Content-Type: text/html;charset=utf-8');
$subject = 'japanesesub【'.$site_name.'】';
$content = "
jp content".$site_name."<br />";
}
$to = $email;
$this->load->library('email');
$this->email->set_mailtype('html');
$this->email->from($fromemail,$fromname);
$this->email->to($to);
$this->email->subject($subject);
$this->email->message($content);
$this->email->send();
redirect('redirect_url');
}