【发布时间】:2015-01-25 17:44:42
【问题描述】:
当! 位于电子邮件正文的标记中时,我的PHP mail() 脚本将某些电子邮件客户端(例如hotmail)上的! 感叹号更改为%21。
这是我的脚本
$to = "myemail@outlook.com";
$subject = "Password Reset";
$body = "<a href=\"http://example.com/#!/page\">Link 1</a>
<br><br>
Without href: http://example.com/#!/page - regular text
";
$headers = "From: no-reply@example.com\r\n";
$headers .= "Reply-To: no-reply@example.com\r\n";
$headers .= "Return-Path: no-reply@example.com\r\n";
$headers .= "X-Mailer: PHP5\n";
$headers .= 'MIME-Version: 1.0' . "\n";
$headers .= 'Content-type: text/html; charset=utf-8' . "\r\n";
mail($to,$subject,$body,$headers);
所以在上面的脚本中,! 只有在它是链接时才更改为%21,常规文本将其保持为/#!/,而不是将其转换为/#%21/
我将如何解决此问题,使其不会更改为 %21?
【问题讨论】:
标签: php email html-email html-entities html-encode