当我发送电子邮件时,电子邮件不会显示英语以外的字符.它确实如下所示:
ä½™C"雅»ä»
实际上可能知道这是什么原因?即使我尝试在脚本中添加Content-type和charset,它仍然显示相同.
我用了 Mail::Factory("mail");
<?php
require_once('../class.phpmailer.php');
//include("../class.smtp.php"); // optional, gets called from within class.phpmailer.php if not already loaded
iconv_set_encoding("internal_encoding", "UTF-8");
$mail = new PHPMailer();
$mail->CharSet = "utf8";
/*
$body = file_get_contents('contents.html');
$body = eregi_replace("[\]",'',$body);
*/
$mail->IsSMTP(); // telling the class to use SMTP
//$mail->Host = "mail.app-cpr.com"; // SMTP server
//$mail->SMTPDebug = 2; // enables SMTP debug information (for testing)
// 1 = errors and messages
// 2 = messages only
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->SMTPSecure = "tls"; // sets the prefix …Run Code Online (Sandbox Code Playgroud)