防止手机格式转换号码到电话号码链接


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;}