How to Create a Mailto
The "mailto" link is used in order to send email from an HTML page that is displayed in a web browser. It is used in an anchor tag, or <a>, as part of the "href" attribute. Href is most commonly used to link one website to another. When using "mailto" you define the email address of the recipient and the subject of the email that is sent.
Instructions
-
-
1
Open your HTML page in a text editor.
-
2
Use the following code to create an email link using an anchor tag:
<a href="mailto:test@email.com?Subject=Hello%20name">
-
-
3
Replace the "test@email.com" in the sample code with the email address that you wish to use. Replace "name" with the recipient's name. Leave "%20" as this will place a blank space in between the word "Hello" and the recipient's name.
-
4
Close the anchor tag and insert the text that you want to display as a link:
<a href="mailto:test@email.com?Subject=Hello%20name"> Click here to send an email </a>
Replace "Click here to send an email" with the text that you want to display.
-
5
Save your HTML file and open it in your web browser to test the "mailto" link.
-
1
Tips & Warnings
The "mailto" link sends an email via an email application. Popular webmail services such as Yahoo Mail and Gmail are able to send email with the "mailto" link.
References
- Photo Credit Comstock/Comstock/Getty Images