Possible “mailto” variable names

Using the “mailto” function in any HTML code is a nice idea if you want your website visitors to save time in opening their default email program and copy-pasting your email address/es. Nowadays, web developers use the mailto in anchor HTML tags as the HREF (or Hypertext REFerence) to save their visitors time in opening Outlook Express, MS Outlook, Mozilla Thunderbird or any other Desktop-based email applications. Here’s a simple way to do that in your HTML code.

Example: <a href=”mailto: info@websitename.com”>Send Email</a>

Output: Send Email

Clicking on the Send Email above will open the “Compose Window” of your default email program. The info@websitename.com email address will be automatically placed on the “To:” field.

This already save a few minutes of your visitors time but do you know you can save them more time by adding more possible predefined variables names to your mailto function?

In Yoast.com’s mailto link syntax, you can see the full list of possible variable names you can add to the function. These are as follows:

mailto:    to set the recipient, or recipients, separate with comma
&cc=    to set the CC recipient(s)
&bcc=    to set the BCC recipient(s)
&subject=     to set the email subject, URL encode for longer sentences, so replace spaces with %20, etc.
&body=    to set the body of the message, you can add entire sentences here, including line breaks. Line breaks should be converted to %0A.

Below is an example of HTML code using all the possible variables of a mailto function.

Example: <a href=”mailto:info@websitename.com?subject=Hello%20There&cc=help@yahoo.com&bcc=admin@markmaranga.com&body=This%20is%20a%20message”>
Send Mail</a>

Output: Send Email

MS Outlook Compose Message Box

MS Outlook Compose Message Box

The image above shows that all the fields automatically has values, which are set inside the HREF attribute. Most of the time the time only the “To” is used but if you think the other fields are useful, then you can use the other variables.

If you are still unsure of what to do after reading this short blog about possible mailto variables, you can continue reading the mailto variables at CodingForum.com and How to use a variable with mailto at StackOverflow.com. If you want to use the mailto variables in flash, you can check Adobe Community.

Related posts:

Leave a Comment