1
我發送電子郵件使用PHPMailer和通過我的Gmail帳戶與SMTP。這一切都有效,除非在主題中有&
,那麼在我的收件箱中主題有&
phpmailer&在主題作爲&
任何方式使這不會發生?我試着設置字符集並對主題進行編碼。
我的代碼如下
$mail = new PHPMailer();
$mail->IsSMTP(); // telling the class to use SMTP
$mail->CharSet = 'UTF-8';
$mail->SMTPDebug = false;
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->SMTPSecure = "tls"; // sets the prefix to the servier
$mail->Host = "smtp.gmail.com"; // sets GMAIL as the SMTP server
$mail->Port = 587; // set the SMTP port for the GMAIL server
$mail->Username = "[email protected]"; // GMAIL username
$mail->Password = "password"; // GMAIL password
$mail->SetFrom('[email protected]', 'From Person');
$mail->AddReplyTo("[email protected]", "From Person");
$mail->Subject = 'An example with a & in the middle';
$mail->MsgHTML('Some text to send');
$mail->AddAddress('[email protected]');
$mail->Send()
謝謝
看起來像PHPMailer中的一個bug給我。你能收到原始信息嗎? – Brad
原始格式的主題中有&。我可以查看我發送的文件夾中的消息,它也有&。 – bones