How to disable an email link?
I have a more natural suggestion: wrap the email/url in an anchor hyperlink.
<a name="myname">[email protected]</a>
Since the text is already wrapped in a hyperlink, Gmail gives up and leave it alone. :)
(Note: also worked for Apple mail client.)
Even I had the same problem. Gmail would detect and convert mail addresses and ip addresses to links. I used string.replace to enclose dots (.) and @ in blocks. And that works fine for me. sample python code looks like.
text = [email protected]
chars = ['.','@']
encloseIn = 'span'
for char in chars:
text = string.replace(text, char, '<'+encloseIn+'>'+char+'</'+encloseIn+'>')
You can try
Hi, you email is:<br />
test@email.com
By 2021, the best for me would be:
<a href='#' style='text-decoration: none; color:#000000' name='myname'>[email protected]</a>
Explanation
After trying different services like Gmail, Outlook 365, Mailinator, and MyTrashMail, the results are:
• <a>
- wrapping the email into anchor is essential, as raugfer pointed
• href='#'
is necessary for Outlook. Linking to a fake anchor disables following the link.
• text-decoration: none, color:#000000
removes underline and changes color from blue link color to natural text color. For those who want not only to disable the link but make its appearance as usual text.
• name='myname'
wouldn't harm, however, I haven't noticed its necessity.
Any javascript should be avoided, it won't pass Gmail. E.g. , onClick="return false;"
.<script>...</script>
If you want to change the cursor to default, cursor: default
or cursor: auto
won't help. For Gmail only, do without href='#'
Using <span>
or <myspan>
works for Gmail as Prince Mishra stated, but it doesn't help in all the services (in Outlook, for instance).