普通网友 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 神经网络怎么把隐含层变量融合到损失函数中?
  • ¥30 自适应 LMS 算法实现 FIR 最佳维纳滤波器matlab方案
  • ¥15 lingo18勾选global solver求解使用的算法
  • ¥15 全部备份安卓app数据包括密码,可以复制到另一手机上运行
  • ¥15 Python3.5 相关代码写作
  • ¥20 测距传感器数据手册i2c
  • ¥15 RPA正常跑,cmd输入cookies跑不出来
  • ¥15 求帮我调试一下freefem代码
  • ¥15 matlab代码解决,怎么运行
  • ¥15 R语言Rstudio突然无法启动