user2447272
user2447272

Reputation: 21

How to remove automatic hyperlinks in emails sent to Gmail

I am sending an autoresponse email which seems to turn a paragraph text into a hyperlink even though I don't want that to happen. This is only happening to Gmail specifically. The text has to have the .co.uk within as thats the name of the company, so can't remove it by law.

I can't use an image replacement for this.

Does anyone know of any suggestions to this?

Upvotes: 2

Views: 13751

Answers (4)

Rob Campion
Rob Campion

Reputation: 1379

Wrapping the @ and . in <span> seems to work too:

emailAddress = emailAddress.replace(/@/g, '<span>@</span>').replace(/@/g, '<span>@</span>')

Upvotes: 1

Mārtiņš Briedis
Mārtiņš Briedis

Reputation: 17762

All tricks with replacing dots didn't work for me.

I found another trick - just replace first letter of the domain in uppercalse.

For example, I had a link: fotodruka.lv which got replaced, but if I enter Fotodruka.lv it remains as text.

Upvotes: 1

sidharth
sidharth

Reputation: 61

Adding &#8203; is a wise option .

Solution for user2447272 :

Replace .co.uk in your mail body with .&#8203;co.&#8203;uk

Generic solution :

mailBody.replace(".",".&#8203;");

It worked out for me.

Upvotes: 5

John
John

Reputation: 12193

I know Gmail likes to turn addresses and phone numbers into links - not sure why it is doing it to the whole paragraph though... This works to hide the blue hyperlink on phone numbers, so it may work if you wrap your address with this:

<a href="" style="text-decoration:none !important; color:#000001 !important;">somewhere.co.uk</a>

or try a zero width space &#8203;. Never used it myself, but putting it into the middle of your address may make it unrecognizable (hence unconverted) in Gmail. You could also try breaking the address up with spans.

Upvotes: 0

Related Questions