dpg76975 2015-03-22 19:15
浏览 101

使用PHP发送HTML邮件。 链接在Outlook中不起作用

I am using the following mail script.

 <?
 $mailer_returndir  = $_POST['returndir'];
 $mailer_receiver   = $_POST['mailer_receiver'];
 $mailer_subject        = $_POST['mailer_subject'];
 $mailer_extra_text     = str_replace("
","<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>&nbsp;</td></tr>";
                  $mtbodyn          .= "<tr><td width='110' valign='top'>Item:</td><td>".$itemname."</td></tr>";
                  $mtbodyn          .= "<tr><td></td><td>&nbsp;</td></tr>";

                  $mtbodyn          .= "<tr><td width='110' valign='top'>Type:</td><td>".$type."</td></tr>";
                  $mtbodyn          .= "<tr><td></td><td>&nbsp;</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>&nbsp;</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>&nbsp;</td></tr>";
                  $mtbodyn          .= "<tr><td></td><td>&nbsp;</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>
"."MIME-Version: 1.0
" .  
"Content-type: text/html; charset=utf-8");


 header("Location:".$mailer_returndir.".php");
 ?>

When I open the email in outlook and I have links in the body.

The links will be all escaped.

 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. 

In the address bar below, the link shows as follows:

 \'http://MYSITE/DIR/quotations/QT-143.pdf\'

How can this be avoided so the customer can click this link?

  • 写回答

1条回答 默认 最新

  • dporu02280 2015-03-22 19:36
    关注

    Even if it's bad HTML: Try not using a href='someUrl', but a href=someUrl.

    评论

报告相同问题?

悬赏问题

  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料