Reputation: 3533
I'm sending an HTML mail from my app, this mail contains URLs, is there a way to prevents from mail clients to show these URLs as links?
for example:
<table>
<tbody>
<tr>
<td>http://www.google.com</td>
</tr>
</tbody>
</table>
will generate" http://www.google.com
instead I want it to generate a static text.
any thoughts?
Upvotes: 29
Views: 40858
Reputation: 71
The easiest fix is to replace the dot with Unicode Character “․” (U+2024) (small square). https://www.compart.com/en/unicode/U+2024
Example: stackoverflow․com
Upvotes: 2
Reputation: 373
Adding in hidden line break elements in the right places seems to have fixed this for me (for now) in almost all clients, including desktop Outlook, according to Litmus's tests (Apple Mail desktop looks like the main exception).
https:<br style="display: none;"/>//www.w3<br style="display: none;"/>.org/TR/2020/WD-WCAG22-20200227/
Upvotes: 0
Reputation: 2252
I have found the accepted answer doesn't work for Outlook 2013. I have had success with the following:
http<a href='#' style='text-decoration:none; color:#000;'>://www.google.</a>com
Setting the style cursor:default
is not honored by Outlook 2013, but if you only make the middle of the url a hyperlink then a user can still select the link text without the cursor pointer appearing.
Upvotes: 3
Reputation: 686
Use a "zero width space" character: ​
It does as the name implies. It adds a space in your string but the space takes up zero width so instead of looking like two strings, it looks like one.
Upvotes: 20
Reputation: 4575
I didn't have any luck in preventing MacMail and Yahoo Mail from creating links out of any text string ending in .com (or other domain extension). After hours of testing (even 'href=""' and 'href="#"' did not work), I finally inserted my own URL and then manipulated the CSS and inline styles to remove the mail clients' link styling.
Upvotes: 0
Reputation: 33143
This is a feature of some mail clients and there's no foolproof way to stop them from doing whatever they want with the message contents.
You could try to trick the mail clients by wrapping the addresses in empty tags and hope that they aren't smart enough to see through it:
<td><span>http</span><span>://</span>www.<span>google.</span>com</td>
Upvotes: 25
Reputation: 4978
I'd say that largely depends on the mail client and thus is beyond your control. The only option would be to not make it a URL. E.g. write www.google.com (which the user can copy/paste just like the URL.
Upvotes: 0