175

It seems like the mailto links we're embedding in our website fail to do anything in Chrome, though they work in Firefox.

Simple example here: http://jsfiddle.net/wAPNH/

<a href='mailto:test@test.com'>hi this is a test</a>

Do we need to do something special to enable mail links in Chrome?

Crashalot
  • 33,605
  • 61
  • 269
  • 439

19 Answers19

160

This is browser settings specific, i.e. it will behave differently depending on the user's browser settings. The user can change how mailto: links behave in chrome by visiting chrome://settings/handlers, or Chrome Settings->Content Settings->Manage Handlers...

If "email" is not listed on that page, then see this answer regarding how to proceed.

root
  • 1,812
  • 1
  • 12
  • 26
kennypu
  • 5,950
  • 2
  • 22
  • 28
  • 7
    great, what's the default behavior? – Crashalot Jul 14 '13 at 01:17
  • 8
    I believe the default is to run the mail client on the computer. I know at work, it will run thunderbird; if they have outlook installed it may run outlook, etc. Personally, it did not run gmail by default, I had to set it up that way. – kennypu Jul 14 '13 at 01:55
  • 2
    @Crashalot nope. a mailto link is a mailto link – kennypu Jul 14 '13 at 07:33
  • 52
    Opening chrome://settings/handlers gives me an empty box with no option to add a handler. Looks like Chrome is badly broken here: it simply will not open my configured mailer (Thunderbird) in response to a mailto link. – Peter Flynn Mar 11 '15 at 22:15
  • 3
    @PeterFlynn it looks like chrome now will try to run the default mail client installed on the computer. Make sure thunderbird is set as the default mail client. See this link on how to do that: http://kb.mozillazine.org/Default_mail_client#Windows – kennypu Mar 12 '15 at 23:15
  • 1
    it is empty, what are you talking about? – Boris Gafurov Nov 29 '18 at 19:48
  • 1
    On macOS check also in Mail.app which client is your default Email App. – CodeBrauer Apr 11 '19 at 08:37
  • default setting is to use the handler, so jj_'s answer would be better. – Chase Choi Apr 15 '19 at 05:10
131

This is because chrome handles the mailto in different way. You can go to chrome://settings/handlers and make sure that which is the default handler. In your case it will be none (i.e. not listed). Now go to gmail.com. You should see something like this when you click on the button beside the bookmark button.

Set mailto in chrome

If you wish to open all email links through gmail then set "Use Gmail". Now when you click on mailto button, chrome will automatically opens in gmail.

root
  • 1,812
  • 1
  • 12
  • 26
Rajesh Hegde
  • 2,702
  • 1
  • 18
  • 23
45

In my case, chrome was associated as MAILTO protocol in Windows 10.

I changed the association to Outlook using "Default Programs" -> "Associate a file type or protocol with a program".

MAILTO is way below in the list. This screenshot may help.

enter image description here

SamJackSon
  • 1,071
  • 14
  • 19
23

You need to allow gmail to install the service handler for mailto protocol:

1) go to gmail

2) click the small rhombus icon at the end of address bar (screenshot)

3) enjoy

enter image description here

Redoman
  • 3,059
  • 3
  • 34
  • 62
17

I also experienced this issue, and eventually tracked it down to the fact that my link was within an iframe, and my web app uses https. Chrome was blocking it due to this (Chrome would open other mailto links outside of the iframe).

In mailto link not working within a frame chrome (over https), kendsnyder mentioned simply changing

<a href="mailto:...">email</a>

to

<a target="_top" href="mailto:...">email</a>

Voila, problem solved. That mailto link now works in all browsers.

brasofilo
  • 25,496
  • 15
  • 91
  • 179
rrudland
  • 410
  • 3
  • 8
  • I'm curious if using `target=_parent"` would also work. Good find. – Termato Jan 15 '15 at 18:31
  • Thanks. Worked great. @Termato, it would probably work if it was the "top" frame. Just use `target="_top"` or if using JavaScript: `window.top.location.href = 'mailto:...'` – Neil Monroe Nov 01 '16 at 00:05
  • Now target="_top" is also not working :( any alternate workaround. I tried with "_parent" and it is not working too. – Vijay Mishra Feb 17 '17 at 15:41
  • `target="_top"` worked for me within an iframe in Google Chrome – John Doherty Sep 05 '17 at 11:34
  • @Basj is works fine on my (latest) Chrome. Do you have a default mail client on your computer? – Thomas Ayoub Jun 18 '18 at 13:42
  • @ThomasAyoub: me, yes, and on my Chrome, it works. But some clients might not have one, because one customer said "your link is not clickable". (It is if you have a mail client, because I use `mailto:...`) – Basj Jun 18 '18 at 13:51
  • 1
    _top and _parent also doesn't work if mailto url is in iframe comes from other domain. Classic CORRS problem. – Mátyás Horváth Oct 27 '21 at 08:07
  • see this answer for a good solution: https://stackoverflow.com/a/69968239/618172 – darryn.ten Jun 09 '23 at 10:28
9

Fix that worked for me since my Protocol handlers was empty

https://productforums.google.com/forum/#!topic/gmail/CQMCGRvyhCM

See redfish43 reply , to sum up

For mailto: - Make sure you are logged in to Gmail and the active window is your main Gmail page (or nothing will happen). - Copy/paste this into the address bar:

javascript:navigator.registerProtocolHandler("mailto","https://mail.google.com/mail/?extsrc=mailto&url=%s","Gmail")

Add the javascript: to the front again if needed, because when you pasted it, Chrome probably trimmed everything before and including the colon. Then hit enter.

When popup window opens click on "Allow"

Benn
  • 4,840
  • 8
  • 65
  • 106
7

You can try going to chrome://settings/handlers and set value for mailto: to none instead of gmail

Yuriy Galanter
  • 38,833
  • 15
  • 69
  • 136
5

On macOS check also the Mail.app settings, which App is selected as default email App / associated with mailto: links:

If you ever clicked that notification on Gmail, which allows to open links in Gmail instead your App - and after this reset the Chrome handler, you have to edit this manually in your Mail.app Settings.

Screenshot

CodeBrauer
  • 2,690
  • 1
  • 26
  • 51
3

I had the same problem. The problem, by some strange reason Chrome turned himself as the default tool to open a mailto: link. The solution, put your mail client as the default app to open it. How to : http://windows.microsoft.com/en-nz/windows/change-default-programs#1TC=windows-7

Good luck

Crashalot
  • 33,605
  • 61
  • 269
  • 439
Jes
  • 31
  • 1
2

I found this answer on a Google forum that has worked me. In the footnotes it mentions 'googleapps.exe' - I don't have this and it has still worked. Simply follow the instructions below but close down all applications before making changes to the Registry. Also I saved the existing value just in case it didn't work.


Simply type "run" in your search bar, then type "regedit" then travel to:

HKEY_LOCAL_MACHINE\SOFTWARE\Classes\mailto\shell\open\command\ 

edit (double click) "(Default)" to:

"C:\Program Files (x86)\Google\Google Apps\googleapps.exe" --domain= --mailto.google.com="%1" 

That's it! Save and close it and it should work beautifully!

Using this method prevents you from having to download the GMail Notifier, which for those of us with GTalk don't need since it does it for us. I'm not sure why Google can't solve this issue easily.. i've heard Google Apps haven't been tested fully on Windows 7 but it's obvious the same tag works with it.

Note: The only thing with this solution is you need to have the googleapps.exe file on your machine. I believe I got it with my free GooglePack from their site which has now been discontinued. I tried searching the net for a way to download it but weirdly enough it seems it's reserved only for Businesses now and there is no download link available from the web because everyone who has it streamed it using the google updater.. Odd. Anyway good luck!

Jonathan
  • 1,542
  • 3
  • 16
  • 24
Mach1
  • 21
  • 1
1

Another solution is to implement your own custom popup/form/user control that will be universally interpreted across all browsers.

Granted this will not leverage the "mailto" out of the box capabilities. It all depends on what availability adherence you are working against. Unfortunately for myself - the mailto needed to be available to everyone by default without "inconveniencing the client".

Your decision ultimately.

fenix
  • 162
  • 10
1

I solved the problem using this code:

    
<button onclick="email()">Contact me !</button> 

<script>
function email() {
    var str = window.open('mailto:aaaaaa@aaaaaa.net', '_blank');
}
</script>

It worked for me like a charm !

Waleed Aldhahi
  • 373
  • 5
  • 4
0

The usual <a href="mailto:hi@hi.com"></a> should work, but remember you must have a default email program set on your computer. For ex, I'm using Ubuntu 14.04 and the default email is thunderbird, which works fine.

Sheshank S.
  • 3,053
  • 3
  • 19
  • 39
0

'Use Chrome, invite troubles' - Anonymous. (Just a symbolic reference)

Well, Chrome is notoriously famous for a lot of default security-enabled utilities, and that's where your problem originates from.

This can, however, be undone by 'setting the default email client' (as the default email client is unset), or by setting up the default handler under 'chrome://settings/handlers' (by default, it's set to 'Ignore').

  • 1
    Yes, this is one of the most frequent reasons. And, the suggested solution should certainly work. –  Aug 11 '19 at 19:56
0

I just had the same issue. Creating a function solved the problem:

<script>
    function sendEmail(){        
        window.location = "mailto:test@test.com";
    }
</script>

<a onclick="sendEmail();">hi this is a test</a>
Sambarilove
  • 133
  • 1
  • 11
0

I face same issue. because I am working in google chrome and my default app is also google chrome. So, google chrome is not able to open another chrome. So, we need to just change our default app.

You need to update default app settings.

  • search default apps.
  • Email
  • choose an app as a default app.
MrPatel2021
  • 163
  • 8
0

I had trouble with all of the listed solutions. I ended up heading to Gmail and running:

navigator.registerProtocolHandler("mailto", 
  "https://mail.google.com/mail/?extsrc=mailto&url=%s", "Gmail");
Chris
  • 644
  • 1
  • 12
  • 28
-3

You can use like this also,

<a href="javascript:void(0);" onclick="javascript:window.location.href='mailto:info@example.com'; return false;">info@example.com</a>

I think this is best way to resolved for chrome issues.

Thanks..

  • '0', not 'o' in `void()`. This did not appear to work very well for me. Is there something else that needs to be added? – Rob Dec 29 '13 at 23:02
-7

Please check it this:

This is working in chrome and all browser.

<a href="mailto:test.test@gmail.com">Test</a>

try and working in great.