Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable an email link?

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?

like image 660
user502052 Avatar asked Feb 16 '11 07:02

user502052


People also ask

How do I disable links?

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.

How do I turn off links in Gmail?

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.


2 Answers

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.)

like image 110
raugfer Avatar answered Sep 16 '22 11:09

raugfer


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).

like image 32
HoRn Avatar answered Sep 17 '22 11:09

HoRn