Javascript Mailto HTML Format

| | | | | | | | |

The HTML mailto link opens a client visitor’s default mailbox when you are logged in. This type of link allows a user to quickly contact you by email. You can specify a default subject, CC, Bcc, and body with a mailto link.

Sometimes when creating a website for a client, they will want you to include their information on the site. This often involves adding a way to contact the business on the site.

Most of the time these days this will include an email address or phone number of some type. In this article, we are going to take a look at how to link an email into your HTML code. This will allow you to make sure that the client’s default email client opens with the corporate email that the recipient has.

HTML mailto link

An HTML mailto link makes it easy for a user to contact you by email. When a mailto link is clicked, the user’s email client opens. A new email is created addressed to the email in the mailto link.

The most common way to link an email to HTML is to use an anchor tag with href attribute.

the href will point to the email you want to send the email to.

Here is the syntax of a mailto base link:

This link will open a new email vacuum which you are addressed in the users email client of the window . But we can add more info to our mailto link

the mailto link accepts the following: ...

  • E - mail of a user
  • Subject field
  • E - mail CC
  • Send BCC.
  • default body

Let’s take a deeper look at how to use an HTML mailto link.

HTML mailto example

We are creating a "Contact Us" page on our website and would like a link that allows users to send us easily we can implement this link by using the HTML email mailto links feature:.

contact us

If you want to add a subject to the email, you can too!

contact us