繁体   English   中英

阻止将手机格式转换为电话号码链接?

[英]Prevent mobile format conversion of number to phone number link?

注册后,我会向用户发送一封包含激活码的确认电子邮件。 问题在于,当在移动设备(可能还有其他平台)上打开电子邮件时,其下划线并被视为电话号码。

这是发送电子邮件的PHP代码:

$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" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
$headers .= 'From: <support@website.com>' . "\r\n";

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

如您所见,我添加了

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

应该可以停止这种行为,但显然不适用于电子邮件。 还有什么我可以做的吗?

尽管这似乎是一个重复的问题,但没有其他答案对我有用。 但是,我能够提出一种适用于我的情况的解决方案。

在HTML电子邮件的<head>中,在<style>标记内添加以下内容。

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

如果需要,还可以设置其他样式。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM