防止将数字的移动格式转换为 phone 数字 link?

Prevent mobile format conversion of number to phone number link?

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

这是发送电子邮件的 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" />

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

虽然这似乎是一个重复的问题,但 none 的其他答案对我有用。但是,我能够想出一个适合我的情况的解决方案。

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

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

您也可以根据需要设置其他样式。