我把phpmailer对象输出
object(PHPMailer)#8 (57) {
["Priority"] => int(3)
["CharSet"] => string(5) "utf-8"
["ContentType"] => string(9) "text/html"
["Encoding"] => string(4) "8bit"
["ErrorInfo"] => string(0) ""
["From"] => string(18) "[email protected]"
["FromName"] => string(6) "duncan"
["Sender"] => string(0) ""
["Subject"] => string(6) "标题"
...["Subject"] => string(6) "标题"
但是邮件收到打开后的标题却是“标题标题”
不知为何重复了?
object(PHPMailer)#8 (57) {
["Priority"] => int(3)
["CharSet"] => string(5) "utf-8"
["ContentType"] => string(9) "text/html"
["Encoding"] => string(4) "8bit"
["ErrorInfo"] => string(0) ""
["From"] => string(18) "[email protected]"
["FromName"] => string(6) "duncan"
["Sender"] => string(0) ""
["Subject"] => string(6) "标题"
...["Subject"] => string(6) "标题"
但是邮件收到打开后的标题却是“标题标题”
不知为何重复了?
$mail = new PHPMailer();
$mail->IsSMTP(); // set mailer to use SMTP
$mail->Host = $_POST['host']; // specify main and backup server
$mail->SMTPAuth = false; // turn on SMTP authentication
$mail->From = $_POST['from'];
$mail->FromName = $_POST['name'];
$mail->AddAddress("$to",$_POST['name']); // name is optional
$mail->IsHTML(true); // set email format to HTML
$mail->Subject = $_POST['subject'];
$mail->CharSet="utf-8";
$mail->Body = $_POST['content'];
$mail->Send();
require_once(dirname(__FILE__).'/phpmailer/class.phpmailer.php');
$mail = new PHPMailer();
$mail->CharSet = "utf-8"; // 设置字符集编码
$mail->Encoding = "base64";//设置文本编码方式
$mail->SMTPSecure = "ssl"; // sets the prefix to the servier
$mail->Host = "smtp.126.com"; // sets GMAIL as the SMTP server
$mail->Port = 465; // set the SMTP port
$mail->Username = "[email protected]"; // GMAIL username
$mail->Password = "test"; // GMAIL password $mail->SetFrom('[email protected]', 'test');
$mail->AddReplyTo('[email protected]','test'); $mail->AddAddress('[email protected]', "totest");
$mail->Subject = 'subject';
$mail->MsgHTML($message); if(!$mail->Send()) {
return false;
} else {
return true;
}
查看你的phpmailer类里边是不是有类似这样的语句:
$header[] = sprintf("标题%s\n", trim($this->Subject));//应该在create_header方法里边。