8

One of my clients wants to disable the URL to be shown as a hyperlinked URL, it has to be recognized as plain text, this is what I have tried:

<a href="..." style="text-decoration:none!important">ur<!comments>l</a>

I have also tried to remove the <a></a> tag, as well as remove "http://" of the URL, none of them worked in Outlook. Outlook still recognized it as a hyperlink.

Anybody have any workaround here?

riQQ
  • 9,878
  • 7
  • 49
  • 66
user1041029
  • 133
  • 1
  • 2
  • 9

10 Answers10

18

There is a zero-width non-breaking space that I like to use: &#65279;

I place it in strategic places so that the URL does not get recognized as a URL, like so: http&#65279;://www&#65279;domain.&#65279;com.

This strategy has worked for me across platforms and rendering clients. Its advantages are twofold: 1) it prevents the client from auto-rendering text as a link, and 2) unlike other "non-breaking" zero-width space ascii codes (ie &#8302;), it wraps the entire URL if your URL happens to need it (instead of just the parts after the zero-width space).

Try it out.

Scott
  • 309
  • 3
  • 8
  • 1
    This is really good. Only one issue with this is, if user would copy/paste the link. It comes with the non-breaking space. Anybody figured a way to copy without those "invisible" spaces? – obai Dec 30 '15 at 18:10
14

Credit belongs to my coworker, actually. Seems to work in all clients that we tested.

www.websitename.<img src="" width="0" height="0">com

An empty image tag with 0 width and 0 height. Insert it between the dot and the following text (in this case "com").

After we tried several things, he somehow suffered from a moment of inspiration/brilliance.

No visible spacing between the characters. Not sure what will happen if you copy/paste the string into a browser directly, though. It served my purpose of not allowing email clients to automatically make it a hyperlink, though.

Seyeong Jeong
  • 10,658
  • 2
  • 28
  • 39
janusoo
  • 141
  • 1
  • 2
  • Turns out it worked on every client except Yahoo! mail. We added the zero width non-breaking space that Scott recommended and that seemed to cover all the bases. Looks like the empty image tag added a little extra margin-bottom or something on some clients, though. I'll post an update if I find a solution for that. – janusoo Oct 07 '13 at 14:20
  • Also, put it after both the www[dot] and the websitename[dot]. Yahoo! tried to make a hyperlink out of just www[dot], which kinda surprised me. So, the updated version looks like this: www.websitename.com – janusoo Oct 07 '13 at 14:35
  • Serious question: Is this well-formed html? – Keyslinger Aug 14 '20 at 19:52
4

This one worked for me. It is a combination of Scott's answer and David K. Hess's comment.

Break your url using <span>. However, you need to break it in a way that they are not matched as url when the mail client scans it.

eg: http<span>://</span><span>google.</span>com 
obai
  • 399
  • 5
  • 14
2

I have a similar issue with words like "chequed.com" and "interviewing.com" that are creating a hyperlink in my messages when I do not want it to.

The first step I took was to edit the HTML link tags.. but there weren't any.

After that, I went to the text in the email and added a very small space by using a fount of 8pt (im using an ESP, otherwise I would have gone with 1px)

This may help if you're having the same issue.

Kyle
  • 21
  • 1
2

My solution for this is

<a href="#" style="text-decoration:none!important">http://...</a>
Nepoxx
  • 4,849
  • 5
  • 42
  • 61
2

I contacted Gmail's support and spoke with a department manager for Apple Care. This is expected behavior and cannot be prevented. These hacks no longer work, and if implemented could result in your IP being listed as a phishing operation. You're dancing around security issues here. I would suggest revising your content strategy.

The only thing you can do currently is wrap all email addresses in mailto links and phone numbers in tel links. There are no other options available as of 2017.

Brett Hamm
  • 23
  • 2
  • There are CSS and inline ways of doing this. Its recommended by a lot of sites and none have sited phishing or blacklisting with these strategies. My answer uses simple CSS to do this change: [here](https://stackoverflow.com/questions/5013625/how-to-disable-an-email-link/52158124#52158124) – Syfer Sep 04 '18 at 05:12
  • IMO, this isn't so much about "dancing around security issues" as trying to improve security. Clickable links express authority. With many email clients, if an attacker is able to insert the plain text "example.com" into an email, then it becomes clickable. Having a supported way to tell clients to NOT make links clickable is not a complete solution, but it is a step in the right direction. – phylae Oct 23 '18 at 17:50
  • 1
    Agreed: given that TLDs now can be ANYTHING (".calvinklein", ".onyourside", ".americanfamily" exist along with hundreds of others), we cannot send out any emails that contain, eg user-provided filenames even if we permit only alphanumerics and dots in filenames, since they may still become malicious links. This makes a mockery of any input or output filtering security. – Dewi Morgan Aug 08 '19 at 19:19
2

I had success with janusoo's solution for years until for some reason it began to introduce line breaks on some clients. I found that I could proceed with &#8203;

www.websitename.&#8203;com
Keyslinger
  • 4,903
  • 7
  • 42
  • 50
  • I've been using this solution, however in multiple clients this causes "[Message clipped] View entire message" at the bottom of the email. Probably something related to this character not being standard UTF-8 – Ahmed Mohamedeen Mar 28 '23 at 02:44
2

You can turn off auto-hyperlinking in general. Here is a tutorial for Outlook 2007:

Turn automatic hyperlinking on or off

JimmyPena
  • 8,694
  • 6
  • 43
  • 64
  • 1
    Thanks for your suggestion JP, I was looking at turning automatic hyperlinking off from a scripting point of view, as the link has to go to a few thousand emails, so it's a hassle to ask them to do the steps. – user1041029 Dec 08 '11 at 02:53
  • I'm afraid automatic conversion of hyperlinks is done at the client level. – JimmyPena Dec 08 '11 at 11:16
  • And it's none of my business, but I'm having trouble understand the requirement that the URL not be a hyperlink. – JimmyPena Dec 08 '11 at 11:17
  • 1
    @JimmyPena: In a title: "Now integrated with Paypal.com!", or in a highscore table which might contain usernames like "example.com", you generally won't want those texts to include a bluelink. No automated email which might contain user-provided content should ever allow a malicious user to create potentially malicious links in that content. If mail clients turn non-linked user-provided usernames like 'see.for.example.bible' or file listings like "example.bible, example.com, ..." into links, then that may become not just a styling problem, but a security problem. – Dewi Morgan Aug 08 '19 at 19:06
1

If you use &#46; to replace your '.' in your hyperlinks you'll solve Outlook 2007 Hyperlinking the URL.

soulglider
  • 161
  • 1
  • 4
1

You might try using CSS to re-flow the text.

<p>www.example.<span style="float:left">http://</span>com/</p>

If the part with "http://" still gets marked as a URL, try breaking things up in different places.

One other trick would be to replace the periods with some other Unicode character that LOOKS like a period but actually isn't. For example, "⠄" (U-2840) is a Braille single-dot.

Alas (!) I don't have any Microsoft applications I can test this with, but good luck with it. :)

ghoti
  • 45,319
  • 8
  • 65
  • 104
  • Thanks ghoti, I tried this, but U-2840 just came up as a square box, not a dot, and then I tried the unicode of a full stop . or . and it has automatically been hyperlinked in outlook, i didn't even add "http://" as part of the link – user1041029 Dec 06 '11 at 04:31
  • Well, a "full stop" *is* a period, so that doesn't get you any further ahead. If U-2840 is a box in the font you're using, you can use an interpunct (·) or a dot operator (⋅). Of course, if you can use an alternate dot to confuse Outlook, then you can probably dispense with the style="float:left" diversion as well. – ghoti Dec 06 '11 at 12:39
  • the mid dot is displaying correctly in Outlook with no hyperlink, however the "url" won't be recognised in a browser unless those "middot" has been replaced with a period. the style="float:left" doesn't seem to work in Outlook either, as the link has been messed up with text been relocated, e.g. http://.goog.comwww displaying in Outlook – user1041029 Dec 07 '11 at 00:10
  • I thought stopping the string from being interpreted as a link was the whole point of this question. The phrase you used was "disable the url". – ghoti Dec 07 '11 at 02:12
  • 1
    Hi ghoti, sorry for the confusion, hyperlinking has to be removed, yet it can be accessed when paste into a browser. I want to make sure a url would not be treated as a clickable link, rather a plain text. – user1041029 Dec 07 '11 at 04:14
  • 1
    I'm going to give up on this one. It's either a hyperlink, or it's not. You can affect the *display* of the link, so that it's not underlined, but if "hyperlinking has to be removed" on the same HTML that needs to render as a link in a browser, then I suspect you're out of luck. – ghoti Dec 07 '11 at 21:06
  • Really appreciate your help so far. I have tried a few other things, but didn't help neither, it looks like this is specific to Outlook, as it has turned out to be a plain text in hotmail. I'll have to give up on this. – user1041029 Dec 08 '11 at 02:51