在 PHP 中,我使用 PHPMailer 5.2.4 发送电子邮件,但我在 Hotmail 中遇到了一个非常奇怪的问题(在其他电子邮件阅读器中运行良好)。
发送的电子邮件有一个链接,例如: http ://www.noticenter.com.br/?modulo=noticias&caderno=geral¬icia=01343-avioes-fabricados-em-sc-participam-de-feira-nos-eua
在 Outlook(和其他电子邮件阅读器)中,链接是正确的: http ://www.noticenter.com.br/index.php?modulo=noticias&caderno=geral%c2%acicia=01343-avioes-fabricados-em-sc-参与德费拉诺斯欧亚
但是在Hotmail中,我 在“%c2%”的位置得到了一个“¬”: http: //www.noticenter.com.br/index.php? modulo=noticias&caderno=geral ¬icia=01343-avioes-fabricados- em-sc-participam-de-feira-nos-eua
这是我用来发送电子邮件的一段代码:
$content = 'Link: <a href="http://www.noticenter.com.br/?modulo=noticias&caderno=geral¬icia=01343-avioes-fabricados-em-sc-participam-de-feira-nos-eua">http://www.noticenter.com.br/?modulo=noticias&caderno=geral¬icia=01343-avioes-fabricados-em-sc-participam-de-feira-nos-eua</a>';
$mail = new phpmailer();
$mail->SMTPDebug = 0;
$mail->Host = emailServerNews_Host;
$mail->Mailer = emailServerNews_Mailer;
$mail->SMTPAuth = emailServerNews_Authentication;
$mail->Username = emailServerNews_Username;
$mail->Password = emailServerNews_Password;
$mail->Port = emailServerNews_Port;
$mail->From = 'email@domain';
$mail->FromName = utf8_encode($title);
$mail->Body = utf8_encode($content);
$mail->AltBody = "HTML";
$mail->Subject = '=?UTF-8?B?'.base64_encode($subject).'?=';
$mail->AddReplyTo('email@domain');
$mail->CharSet = "UTF-8";
$mail->AddAddress($email, utf8_encode($name));
if($mail->Send() == true){
$ErrorInfo = $mail->ErrorInfo;
return true;
}else{
$ErrorInfo = $mail->ErrorInfo;
return false;
}