|
Form Tip:
Beware of Form Mailto Action
by Tom Dahm,
Chief Operations Officer,
NetMechanic, Inc.
If you've just started working with HTML forms, then you're probably using the "mailto" action to send the form data via email. That's not a good idea, since this method is unreliable.
The Web is the most interactive form of mass communication ever invented. With HTML, everyone in the world can become a publisher, posting their thoughts for anyone to read. Sooner or later, though, you'll want that communication to flow both ways, with visitors to your site having a chance to give you feedback.
While you can do that with a simple HREF "mailto" link, this kind of feedback is unstructured. Often you'll want visitors to give you specific information. That's especially true if you're running a business site and want visitors to submit orders or requests for information. In these cases you'll need an HTML form.
Forms are processed by submission to a CGI script. Unfortunately, CGI scripts require a fair amount of programming knowledge to create. Moreover, these scripts aren't cut-and-paste friendly in the same way that JavaScript programs are. Just learning how to configure a ready-made CGI script on your server can be a real headache.
As a result, many Webmaster prefer to submit their forms via email, setting the form's ACTION attribute to a "mailto" value. The code below shows a sample form using this approach:
<form method="post"
action="mailto:yourname@yoursite.com"
enctype="text/plain">
<input type=text
name=your_comments>
<input type=submit
value="Submit Your Comments">
</form>
|
This looks great, and may even work on your machine. But it doesn't work reliably for all visitors to your site. Whether or not a visitor can use this method depends on the mail client installed on their computer. And unfortunately, there's no way to test if that's the case for each of your visitors.
This can lead to the worst kind of situation where someone takes to time to give you feedback, then finds that they can't send the information to you!
Instead of using the "mailto" method, try using a remotely hosted CGI script like Response-O-Matic. This free service lets you access a CGI script run off of their servers. You build your HTML form as you normally would, but instead of setting the ACTION attribute to a "mailto," you fill in the URL of the remote CGI script. The CGI script translates your form into an email message and sends it on to the address you provide.
This approach is much more reliable than the "mailto" method. Try it, and see if it works for you.
|