0

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

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?

EternalHour
  • 8,308
  • 6
  • 38
  • 57
  • Are you using an email client or browser to open this email ? – Bajji Jul 23 '15 at 22:11
  • Have you tried a css solution? like forcing the styling you want on the activation code. – dramzy Jul 23 '15 at 22:13
  • possible duplicate of [Mobile Safari/ iPhone Mail.app HTML design issues: prevent autolinking and styling auto-links (dates, addresses, etc.)](http://stackoverflow.com/questions/5265443/mobile-safari-iphone-mail-app-html-design-issues-prevent-autolinking-and-styli) – Angela Jul 23 '15 at 22:13
  • Its not a problem with your email, its a problem with their email client. Not much you can do about it. – Gabe Sechan Jul 23 '15 at 22:22
  • I am testing with the android email client. Unfortunately none of the answers in the supposed duplicate question work. – EternalHour Jul 23 '15 at 22:27
  • @RespectMyAuthoritah - I had my doubts that it would work, but it did :) – EternalHour Jul 23 '15 at 22:42

1 Answers1

0

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.

EternalHour
  • 8,308
  • 6
  • 38
  • 57