How to add a subject to a mailto anchor in HTML

Updated: 12/09/2018 by Computer Hope

EmailAdding the subject to the mailto HTML tag can be an easy way to help direct e-mails when listing more than one e-mail address on your website or blog.

Using the mailto in the a href HTML tag allows you to send an e-mail using the installed e-mail client. If you want to add a subject to that e-mail add ?subject=<subject> to the mailto tag.

For example, the complete tag would look similar to the example below.

<a href="mailto:[email protected]?subject=Testing out mailto!">First Example</a>

You can also add text into the body of the message by adding &body=body to the end of the tag, as shown in the example below.

<a href="mailto:[email protected]?subject=Testing out mailto!&body=This is only a test!">Second Example</a>

You can also include &cc= or &bcc= to fill out the CC and BCC fields.

Note: Keep in mind that if you are using a web mail service such as Yahoo! mail or Gmail that it will not open these services to start an e-mail. These links are only designed to send e-mail from the installed e-mail client, such as Outlook and Thunderbird.

Examples

First Example

Second Example

Additional information