I am using Ruby on Rails 3 and I would like to disable an email address link in a HTML email.
For example, if in an email I send some raw HTML like
Hi, you email is: <br/>
[email protected]
Gmail autodetects that this is an email address and changes it to
Hi, you email is: <br/>
<a target="_blank" href="mailto:[email protected]">[email protected]</a>
I would like to have this output
# Text without the 'mailto:' link
Hi, you email is:
[email protected]
How can I do that?
Disable a link # It is still possible to disable a link by following 3 steps: remove the href attribute so that it can no longer receive the focus. add a role="link" so that it is always considered a link by screen readers. add an attribute aria-disabled="true" so that it is indicated as being disabled.
Disable links. Hold Ctrl+Alt to disable the links temporarily. This extension is deprecated - Chrome has a built-in feature for this, just holding Alt while selecting prevents the link from being clicked. You can safely remove it.
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.)
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).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With