Stop mail clients auto linking text as URLs — sebduggan.uk Skip to main content
sebduggan.uk

Stop mail clients auto linking text as URLs

This is just a quickie -- a reminder for my own reference, but could also be useful to others.

I'm building a shop, and the email confirmations include the line:

Your credit card statement will show a payment to "MYDOMAIN.COM".

Which is fine, except that many mail clients (e.g. Apple Mail) will take MYDOMAIN.COM and link it as a URL -- which I don't want.

To avoid this, simply add a zero width space into the URL -- for instance:

Your credit card statement will show a payment to "MYDOMAIN​.COM".

(That's the HTML version. If you're generating a plain text alternative (using CFML, of course), you'll want to use #Chr(8203)#).

The text will now look identical -- except it will not be linked by the mail client.