The Best Guide to HTML Mailto Attribute

It would be difficult to find anyone who works online that hasn’t interacted with the HTML mailto link. When you click on it, this link activates the default email client on a user's computer to send an email. It is used inside an anchor tag with a href attribute. In this article, we will discuss: 

  • What is a mailto link in HTML?
  • How to create mailto links in HTML
  • Mailto parameters 

What is a Mailto Link in HTML?

Mailto links are used to redirect the user to an email address instead of a link. When the user clicks on a mailto link, the default email client opens on the user’s computer and suggests sending an email to the address included in the mailto link.

Get skilled in HTML5 and CSS3 with the Full Stack Java Developer Master's Program. Click to check out the program details!

How to Create Mailto Links in HTML?

You can create an HTML mailto link by using an anchor tag with the href attribute and inserting the “mailto” parameter after it.

html-mailto

The code will generate the following link:

Send Email

Clicking on the link above will open a new mail window:

output-html-mailto

If you want to send an email to more than one address, separate your email address with a comma.

secondmail

Full Stack Web Developer Course

To become an expert in MEAN StackView Course
Full Stack Web Developer Course

Mailto Parameters

The mailto attribute accepts seven parameters, as described below: 

  • mailto: This parameter specifies the email address of the recipient.
  • cc: This parameter is used to add another email address that will receive the mail's carbon copy. It is optional.
  • bcc: This parameter specifies another email that will receive the blind carbon copy of the mail. It is optional.
  • subject: This parameter is used to fill the subject of the mail. It is optional.
  • body: This parameter is used to fill the content of the mail. It is optional.
  • ?: This parameter is the first parameter delimiter. It is optional.
  • @: This holds the other parameter delimiter. It is optional.

html-mailto-parameter

html-mailto-parameters.

Wrapping Up

You may be wondering how you can obtain the skills necessary to take advantage of HTML’s immense popularity, and how you can go beyond just learning about the HTML mailto attribute.  You can enroll in a comprehensive  Full Stack Java Developer course to help you become career-ready upon completion. To learn more, check out our YouTube video that provides a quick introduction to HTML and explains how to write a simple ‘Hello World’ program in HTML. 

If you’re an aspiring web and mobile developer, HTML training will broaden your skills and career opportunities. Do you have any questions for us? Please ask them in the comments section, and we'll have our experts answer them for you.

About the Author

Aryan GuptaAryan Gupta

Aryan is a tech enthusiast who likes to stay updated about trending technologies of today. He is passionate about all things technology, a keen researcher, and writes to inspire. Aside from technology, he is an active football player and a keen enthusiast of the game.

View More
  • Disclaimer
  • PMP, PMI, PMBOK, CAPM, PgMP, PfMP, ACP, PBA, RMP, SP, and OPM3 are registered marks of the Project Management Institute, Inc.