Skip to content

About mailto link HTML | Open default mail client

HTML mailto attribute uses to create a mail link that activates the default mail client on the computer for sending an e-mail. It will open default e-mail client software or app.

Note: Default mail program (installed Software/Apps) required to activate the e-mail client.

Example of mailto link HTML

Just use <a> tag and href to create email link.

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

Some important attributes can use:-

ParameterDescription
mailto:[email protected]e-mail recipient address
cc=[email protected]carbon copy e-mail address
bcc=[email protected]blind carbon copy e-mail address
subject=subject textsubject of e-mail
body=body textbody of e-mail
?first parameter delimiter
&other parameters delimiter

Code

<!DOCTYPE html>
<html>
<body>

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

</body>
</html>

Output: If default mail client is Microsoft Outlook, then pressing a mailto link will open a new mail window.

Create mailto link HTML

Email address with the subject

<a href="mailto:[email protected]?subject=The%20subject%20of%20the%20mail">
Send mail with subject</a>

Adding CC and BCC

Use parameters cc and bcc to the href value.

<a href="mailto:[email protected][email protected], [email protected], 
[email protected]&amp;[email protected]&amp;subject=Big%20News">
Email Us</a>

Adding Body Text

Just add the body parameter into list of parameters.

<a href="mailto:[email protected][email protected], [email protected], 
[email protected]&amp;[email protected]&amp;subject=Big%20News&amp;body=Body-goes-here">
Email Us</a>

mailto link with subject and body

mailto with content:

<a href="mailto:[email protected]?subject=look at this website&body=Hi,I 
found this website and thought you might like it http://www.geocities.com/wowhtml/">
tell a friend</a>

Add spaces in the mail’s subject or body

Add spaces by writing %20 in the text of the subject or body.

<a href="mailto:[email protected]?subject=The%20subject&amp;body=This%20is%20a%20message%20body">
Send mail</a>

Add line break in the mail’s body

Add newline by writing %0D%0A in the text of the body.

<a href="mailto:[email protected]?body=Line1-text%0D%0ALine2-text">Send mail</a>

Do comment if you have any doubts and suggestions on this topics.

Note: The All HTML Examples codes are tested on the Firefox browser and the Chrome browser.

OS: Windows 10

Code: HTML 5 Version

1 thought on “About mailto link HTML | Open default mail client”

  1. The new line character is exactly what I have needed, thanks! I’ve been trying to just open an email client window and format some text with a new line. I didn’t know there was a new line char for emails. I’m using javascript, electron and quasar and this is an elegant, simple solution!

Leave a Reply

Discover more from Tutorial

Subscribe now to keep reading and get access to the full archive.

Continue reading