doxn43207 2014-10-21 22:08
浏览 122

php邮件功能,如何避免邮件中的超链接

I'm using the php mail function and I have no problem sending the emails, I recieve well the emails on Hotmail and Gmail. But, when I wrote a web address in the message Gmail doesn't accepts the email because it arrives with an hyperlink, even though i'm writing the address in this way: "www.something.com" and I'm using Content-Type: text/plain; on the header. I've tried to use strip_tags() with the message, but the problem persist. What can I do?

  • 写回答

1条回答 默认 最新

  • doujia6433 2014-10-21 22:15
    关注

    Please try the code as follow:

    <?php
    $to = "to_email addrss";
    $subject = "Your Subject";
    $message = "
    <html>
    <head>
    <title>HTML email</title>
    </head>
    <body>
    <p>This email contains HTML Tags!</p>
    <a href='http://yourlink.com'>http://yourlink.com</a>
    </body>
    </html>
    ";
    
    
    $headers = "MIME-Version: 1.0" . "
    ";
    $headers .= "Content-type:text/html;charset=UTF-8" . "
    ";
    $headers .= 'From: <webmaster@yoursite>' . "
    ";
    mail($to,$subject,$message,$headers);
    

    ?>

    May be you failed to add content-type:text/html ,while sending your email address. may be this is the reason your anchor link it not working.hope this will work.

    评论

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度