我使用以下邮件脚本。
<?
$mailer_returndir = $_POST['returndir'];
$mailer_receiver = $_POST['mailer_receiver'];
$mailer_subject = $_POST['mailer_subject'];
$mailer_extra_text = str_replace("\n","<br>",$_POST['mailer_extra_text']);
$mailer_text_html = $_POST['mailer_text_html'];
$mailer_body = "<span class='style1'>".$mailer_extra_text."<br><br></span>".$mailer_text_html;
$bodyn1 ="<html xmlns='http://www.w3.org/1999/xhtml'>";
$bodyn1 .="<head>";
$bodyn1 .="<meta http-equiv='Content-Type' content='text/html; charset=utf-8' />";
$bodyn1 .="<title>MYSITE HEADER ".$datetd."</title>";
$bodyn1 .="<style>.style1{color:#000;font-family:Arial,Helvetica,sans-serif;font-size:12px;}";
$bodyn1 .="</style>";
$bodyn1 .="</head>";
$bodyn1 .="<body class='style1'>";
$mtsubjectn = "MYSITE Sizechart for ".$customer;
$mtbodyn = "<h3>MYSITE - Sizechart - ".$file."</h3><br>";
$mtbodyn .= "<table>";
$mtbodyn .= "<tr><td width='110' valign='top'>Customer:</td><td>".$customer."</td></tr>";
$mtbodyn .= "<tr><td></td><td> </td></tr>";
$mtbodyn .= "<tr><td width='110' valign='top'>Item:</td><td>".$itemname."</td></tr>";
$mtbodyn .= "<tr><td></td><td> </td></tr>";
$mtbodyn .= "<tr><td width='110' valign='top'>Type:</td><td>".$type."</td></tr>";
$mtbodyn .= "<tr><td></td><td> </td></tr>";
$mtbodyn .= "<tr><td></td><td>Click the link below to view your quotation as a .xls file</td></tr>";
$mtbodyn .= "<tr><td></td><td> </td></tr>";
$mtbodyn .= "<tr><td valign='top'>Quotation File:</td>";
$mtbodyn .= "<td>";
$mtbodyn .= "<a href='MYSITE/DIR/sizechart/".$file.".xls'>";
$mtbodyn .= "sizechart/".$file.".xls</a>";
$mtbodyn .= "</td></tr>";
$mtbodyn .= "<tr><td></td><td> </td></tr>";
$mtbodyn .= "<tr><td></td><td> </td></tr>";
$mtbodyn .= "<tr><td colspan='2' align='center'>www.MYSITE.com</td></tr>";
$mtbodyn .= "<tr><td colspan='2' align='center'>This is an automatically generated email.</td></tr>";
$bodyn3 ="</body>";
$bodyn3 .="</html>";
$mailer_body = $bodyn1.$mtbodyn.$bodyn3;
mail($mailer_receiver,$mtsubjectn,$mailer_body,"From: MYSITE <MYEMAIL>\r\n"."MIME-Version: 1.0\n" .
"Content-type: text/html; charset=utf-8");
header("Location:".$mailer_returndir.".php");
?>
当我在outlook中打开电子邮件时,我身上有链接。
链接将全部转义。
Email output:
MYSITE - Quotation - 2015-01-28
Customer: *****
Click the link below to view your quotation as a .pdf file
Quotation File: http://MYSITE/DIR/quotations/QT-143.pdf
www.MYSITE.com
This is an automatically generated email.
在下面的地址栏中,链接显示如下:
\'http://MYSITE/DIR/quotations/QT-143.pdf\'
如何避免这种情况,以便客户点击此链接?
答案 0 :(得分:0)
即使HTML不好:尽量不要使用href ='someUrl',而是使用href = someUrl。