In this short article I will explain the different ways to create and open MailTo Link using JavaScript.
MailTo links are set with email addresses and are used to open the default installed Email (Mail) Client application.
 
 
MailTo using HTML Image element
In order to create MailTo link using image there are two ways: -
1. Using HTML Link
<a href = "mailto:abc@abc.com"><img src = "images/img.jpg" /></a>
 
2. Using JavaScript
<img src = "images/img.jpg" onclick = "parent.location='mailto:abc@abc.com'"
style ="cursor:pointer" />
 
 
 
MailTo using HTML Button element
 
In order to open the default email client on HTML Button click, you will need to set the JavaScript parent.location property to the MailTo link.
 
<input id="Button1" type="button" value="button"
onclick = "parent.location='mailto:abc@abc.com'" />
 
 
Screenshot
Open Defaullt Email (Mail) Client application in ASP.Net
 
 
Browser Compatibility

The above code has been tested in the following browsers.

Internet Explorer  FireFox  Chrome  Safari  Opera 

* All browser logos displayed above are property of their respective owners.