href="mailto:" is not working on any of the browsers
Asked Answered
E

6

31

I have created a webpage with some hyperlinks (not online yet).

I'm supposed to include certain hyperlinks for the Email IDs on the page.

I tried to create links in this format:

<a href="mailto:[email protected]">

But these are not opening up using Outlook's new mail, as it is supposed to.

On Chrome, it does nothing. On Firefox, IE & Safari it opens a new blank Chrome Window when I click on the link.

This system is new and has all the above browsers up to date.

Equestrian answered 7/12, 2015 at 8:57 Comment(0)
M
19

Provided you have registered a default email client, this usually works, if you're using an <a> tag as follows:

<a href="mailto:[email protected]">Mail me</a>

To change or check the email client settings, do the following (cited from MSDN) - I have modified it slightly because it differs depending on the Windows version you're using:

  1. Depending on the Windows version:
    Open Default Programs by clicking the Windows Start button, and then clicking Default Programs.
    Or: Open the Control Panel in the Start Menu *), then use the search text box in the upper right corner of the Control Panel screen and type Default Programs there. Hit Enter.

  2. Click Set your default programs.

  3. Under Programs, click the Email program you'd like to use, and then click Set this program as default.

  4. Click OK.

Note

The first time you start them, some email programs display a message asking you if you want to use that program as the default. If you choose to do so, this program will become your default email program, even if you've chosen a different program using "Set your default programs" earlier.


*) In Windows10, you can find the Control Panel, if you open the Windows menu WindowsStart, then click on the cogwheel icon WindowsCogwheel, then enter Control Panel in the search box.

Minica answered 7/12, 2015 at 9:6 Comment(2)
Not the correct answer. In angular these links are blocked due to strict origin when cross originCostplus
@Costplus - The answer is correct. The question was about how to do it in plain HTML. It was not asked for an Angular application. Please ask another question in StackOverflow if you want to know about Angular specifics. I Googled and found there is already a similar question for mail with Angular in Stackoverflow here. Just follow the link and have a look :-)Minica
A
14
  • The other answers didn't resolve my own question, which was resolved as follows.
    • I came to this question because I was experiencing the same issue, with properly formatted email anchors failing to open Gmail when Chrome was set as the default email app. The other answer did not work in Windows 10, with Chrome.
  • In the case of this OP, it seems that Google Chrome is already set as the Default Email app, as indicated by On Firefox, IE & Safari it opens a new blank Chrome Window when I click on the link, and the anchor is properly formatted, because clicking it in other browsers, opens a blank Chrome window.
    • This is the exact description for my own experience, which brought me to this question.

The HTML anchor does not seem to be the culprit.

  • To get Send Mail from <a href="mailto:[email protected] " target="_top">Send Mail</a> to work in Google Chrome in Windows 10:
    1. Go to Settings, Apps, Default Apps, and under Email, select Google Chrome.
      • This step alone, does not necessarily work, I had to set the handler, as shown in the following steps, because Gmail was blocked.
      • enter image description here
    2. In Chrome, go to Settings by selecting enter image description here
    3. Select Privacy and security on the left side of the screen
    4. Select Site Settings
    5. Scroll down to Permissions and select Additional permissions
    6. Select Handlers
    7. Select Allow sites to ask to become default handlers for protocols
      • If a site (e.g. Gmail) is blocked, remove the block
    8. Open Gmail in a new tab and sign in
      • In the address bar, select the enter image description here
        • enter image description here
        • This page wants to install a service handler.
      • Select Allow, and then Done
    9. Return to the Settings tab, and mail.google.com will be the email handler.
      • enter image description here
Athapaskan answered 22/2, 2021 at 16:40 Comment(1)
This one is the best as I don't need to install an email app to get it done. Thanks!Goldsmith
S
8

If you are using Windows 7 or higher, then all you have to do is set the default email client. Check this in the control panel under Default Apps setting. Just click on the email client you want and you are all set.

Stereophotography answered 28/1, 2020 at 11:18 Comment(0)
N
2

Are you sure you are closing the anchor correctly? The full HTML should be this:

<a href="mailto:[email protected]">Test</a>
Nate answered 7/12, 2015 at 9:0 Comment(0)
T
0

Try something like this:

<!DOCTYPE html>
<html>
<body>

<p>
Click to email :
<a href="mailto:[email protected]?Subject=Hello" target="_top">[email protected]</a>
</p>


</body>
</html>
Tommi answered 7/12, 2015 at 9:1 Comment(0)
E
0

If your code is not working by using any of the above solutions, then you the code below. try to wrap

with an anchor tag, In most cases when a tag is in p tag that does not work. so get the tag out of

tag and wrap the

tag.

<a href="mailto:[email protected]"> <p>[email protected]</p> </a>

Eichler answered 23/8, 2023 at 21:21 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.