How to Use HTML mailto With 2 examples

How to Use HTML mailto With 2 examples

 Video: How to use mailto in link tag

mailto in HTML

In HTML hyperlinks, you can use the mailto: in href to enable users sending the email by using their set up email program. For example, on your website, you have a link “contact us”; as a user clicks on this link, the outlook express or another email program that is set up at user’s machine will be opened.

In the mailto: you can specify the email address where email should be sent. Along with it, you can also set subject of email address.

How to use the mailto?

The syntax of HTML mailto is:

<a href=”mailto:toaddress@email.com>Some text</a>

So inside the href attribute of <a> tag, you can place mailto: followed by To email address where you intend to send the email.

Example of using HTML mailto with a link

The example below shows how to link an email address to a hyperlink.

Experience this online

Where you will replace toaddress@email.com address to actual email address where you want to receive email.

Specify subject with mailto link

The example below shows how to include subject as well in the HTML link. So that subject is filled with pre-given text as link opens the email program.

HTML mailto

Experience this online

A final word about mailto

These days, you should use mailto hyperlink quite carefully, as spammers catch the given email address and send spam emails. You can also use HTML email forms along with the captcha (for security) to decrease spam factor.