1. Home
  2. Computing & Technology
  3. Web Design / HTML

Mailto Forms
HTML Forms Tutorial

By , About.com Guide

Getting an HTML form to do something is critical if you're going to use them. But that requires access to a CGI script or other program to point your form to in the action attribute.

If you don't have access to a script, there is one form action that most modern browsers support. That is:

action="mailto:youremailaddress"

This is a simple way to get the form data from your Web site to you. There are some tricks to it, however:

  • Use the enctype="text/plain" attribute
    This will not always prevent the data from showing up on one long line, but it will remove most of the HTTP encoding (such as pluses (+) instead of spaces), and make it easier to read.
  • Use the GET method
    While the post method sometimes works, it usually just causes the browser to open a blank email window.

This is a sample form using the mailto action:

<form enctype="text/plain" method="get" action="mailto:html.guide@about.com">
Your First Name: <input type="text" name="first_name">
<br>
Your Last Name: <input type="text" name="last_name">
<br>
<input type="submit" value="Send">
</form>

The first thing your readers will see when they submit the form is a message saying that the form is being submitted via email. This is what the results look like:

first_name=Jennifer
last_name=Kyrnin

Please note, mailto forms don't always work for all combinations of browsers and email clients. For more information, read my related article When Mailto Forms Don't Work.

Part 7 of the HTML Forms Tutorial: Multiple Page Forms
Store your form data across 2 or more pages of form fields.

Special Note About Mailto Forms

Mailto forms don't always work. If you set up a mailto form and it doesn't work, check out these two articles:

Explore Web Design / HTML
About.com Special Features

Holiday Central

What to eat, where to go, fun things to do and how to save money on the perfect gifts. More >

Family Tech Center

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

  1. Home
  2. Computing & Technology
  3. Web Design / HTML
  4. HTML and XHTML
  5. XHTML
  6. Forms
  7. Mailto Forms - HTML Forms Tutorial - Using Mailto Forms>

©2009 About.com, a part of The New York Times Company.

All rights reserved.