普通网友 2015-07-23 22:05
浏览 34
已采纳

防止号码到电话号码链接的移动格式转换?

Upon registration, I am sending the user a confirmation email with an activation code. The problem, is that when the email is opened on a mobile device (and possibly other platforms) it is underlined and treated as a phone number.

Here is the PHP code that sends the email:

$subject = "website registration";

$body = '
<html>
<head>
<meta name="format-detection" content="telephone=no" />
<style>
.code {margin-bottom: 0; padding: 5px; background-color: #82caff;}
.important {font-weight: bold;}
</style>
</head>
<body>
<p>We have created your account and soon it will be ready to use. But before first you must 
activate it entering your code at the link below.</p>
<p class="code">code: '.$act_code.'</p>
<p><a href="https://www.website.com">Activate your account now</a></p>
<p class="important">Please remember, we will never ask for your account information</p>
</body>
</html>
';

$headers = "MIME-Version: 1.0" . "
";
$headers .= "Content-type:text/html;charset=UTF-8" . "
";
$headers .= 'From: <support@website.com>' . "
";

mail($email,$subject,$body,$headers);

As you can see I added

<meta name="format-detection" content="telephone=no" />

which is supposed to stop this behavior but apparently it doesn't work for email. Is there something else I can do?

  • 写回答

1条回答 默认 最新

  • dongli1887 2015-07-23 22:43
    关注

    Although this is appears to be a duplicate question, none of the other answers worked for me. However, I was able to come up with a solution that worked in my case.

    In the <head> of the HTML email, add the following inside <style> tags.

    a[href^=tel]{text-decoration:none;}
    

    You can also set other styles if you desire.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
  • ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站
  • ¥50 成都蓉城足球俱乐部小程序抢票
  • ¥15 yolov7训练自己的数据集
  • ¥15 esp8266与51单片机连接问题(标签-单片机|关键词-串口)(相关搜索:51单片机|单片机|测试代码)
  • ¥15 电力市场出清matlab yalmip kkt 双层优化问题
  • ¥30 ros小车路径规划实现不了,如何解决?(操作系统-ubuntu)
  • ¥20 matlab yalmip kkt 双层优化问题
  • ¥15 如何在3D高斯飞溅的渲染的场景中获得一个可控的旋转物体
  • ¥88 实在没有想法,需要个思路