Pin Me

Using HTML MailTo Commands

written by: vishalseafarer•edited by: Amber Neely•updated: 9/19/2010

Want to get feedback from visitors about your website? Read on to find out how to use the HTML MailTo command to create a feedback form.

  • slide 1 of 3

    Background of HTML MailTo Commands

    Back in the late 90s and the first half of this decade when webpages were more static than dynamic, HTML MailTo links were used in webpages for feedback from visitors. However they were prone to many attacks similar to the ones caused by the famous love-bug and Melissa worms.

    As pages became more dynamic, developers began using forms instead of the HTML MailTo attribute. This gave the developers more control over the data passed to the server, with better security.

    Before proceeding on how to create a MailTo link, the webpage developer should be aware that not everyone who wants to send feedback using the link will be using an email client or an email reader like Microsoft Outlook or Mozilla Thunderbird. So it is a good practice to create a script to redirect visitors to one of those sites that provide an email client, so that they can use the MailTo feature.

  • slide 2 of 3

    How to Create and Configure the HTML MailTo in Your Webpage:

    For sending an email, three main fields are required. They are:

    1) The email address of the person to whom the email has to be sent,

    2) The subject,

    3) The body of the email.

    In addition to the above three fields, fields like Cc(Carbon Copy), Bcc(Blind Carbon Copy), etc can also be included.

    To embed the mailto function in the webpage:

    1) Creating the mailto attribute:

    Create a mailto attribute inside an anchor tag. Place this inside the body tags of the webpage.

    <a href="">Send Feedback </a>

    This will create a link that will open the email client, that will have the address field filled with the email address (in our case it is

    2) Entering the subject in the subject field:

    Moving on to the next step, we'll add the subject in the subject field.

    <a href =" am an email sent from the mailto link ">Send your Feedback</a>

    Enter the 'subject' keyword followed by the '?' symbol. The '?' symbol separates the email address from other information. The subject keyword is followed by a '=' (equals to) operator after which the subject is entered.

    3) Entering Information in the Body, Cc, Bcc Fields:

    Once the subject is entered, information for other fields like body, Cc and Bcc are entered with their appropriate keywords preceded by a '&'.

    &body=I am the body of the email that you are sending as a feedback



    <a href =" am an email sent from the mailto link&body=I am the body of the email that you are sending as a feedback& ">Send your feedback.</a>

    Quick Guide to Understand the Code:

    <a href ="mailto:email_id_of_the_owner_of_the_webpage?subject=enter_the_subject&body=enter_the_body_field&cc=carboncopy&bcc=blindcarboncopy">Text to be displayed on the webpage.</a>

  • slide 3 of 3

    HTML MailTo Command: Complete Code

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">



    <title>HTML mailto Attribute</title>



    <a href =" am an email sent from the mailto link&body=I am the body of the email that you are sending as a feedback& ">Send your feedback.</a>





    There are some pitfalls that should not be overlooked before using the mailto attribute in a webpage.

    1) The developer should be aware that the visitor might not using an email client.

    2) At times the browser might not be able to identify the email client.

    3) Characters like " < > % in the mailto attribute might cause problems.

    3) It is recommended to use forms instead of the mailto attribute, as the mailto attribute may help in spreading harmful scripts like the melissa and love-bug worms that enter other machines easily and spread themselves over a network.