A New Forms Solution Using Perl or FrontPage
WEBINAR: On-demand webcast
How to Boost Database Development Productivity on Linux, Docker, and Kubernetes with Microsoft SQL Server 2017 REGISTER >
Your Email forms Won't Work?
Is it because they're not supported?
Some of the most common questions our mentor community is asked relate to Email Forms, aka Mailto Forms. These are HTML pages that include a form in which the site visitor can enter some information and send it via email to the intended recipient. There are several common uses for this type of form. They are often used as a feedback mechanism, whereby a visitor can send comments or suggestions about the site back to the webmaster. They are also used as a mechanism to capture data and send it off to a recipient at a remote location, bypassing the need for a database in or near the system where the site is being hosted. Webmasters come up with plenty of creative ways of using these forms, but increasingly over recent months, are also coming up against some problems.
The distinguishing characteristic of an email form is found in its "ACTION" statement in the <FORM> tag. There is a description of this type of form in the HTML Goodies Forms Tutorials
In the example on that page we see this "ACTION" statement:
<FORM METHOD="POST" ACTION="mailto:your email address">
The "ACTION" in this example is a "mailto:" with an email address. It is this which defines this form as an email form.
The problem arises because modern browsers, IE6 + and equivalent, no longer
support email forms! The effect of this is that the visitor fills out the form
and clicks the submit button and their email client program is invoked showing a
blank email with the specified address in the "To" field. All information
entered on the form appears to have been ignored. Essentially, these browsers
are treating the email form as if it was a simple "Mailto" email link (for
information about email links, see
the HTML Mailto: Primer
That's the problem, but like all good programmers all we see is an opportunity for a creative solution!
With that in mind, here are three solution offerings. The first is a solution primarily aimed at Unix (or similar) operating systems, and involves the use of CGI (Common Gateway Interface - see CGI Tutorials) and a mail system such as SENDMAIL (commonly installed on Unix and Linux systems.) The second is a little more specialized, in that it requires FrontPage Extensions, and the last, which uses ASP will only work for those of you who host your sites on Microsoft servers.
The first involves the use of a script to send the email form. One such script
is the very popular formmail.pl originally available from Matt's Script Archive at
http://www.scriptarchive.com/formmail.html although the most recent version, and most secure version, is now obtainable from the NMS project at http://nms-cgi.sourceforge.net/
This script is accessed via the "ACTION" as in this example:
<FORM ACTION="/cgi-bin/formmail.pl" METHOD="POST">
There is a lot of comprehensive help information on Matt's site that describes very well how to use this script, so there is not much point in going into details here. There are a couple of things to point out, however. First, in order to use this script, the host system must support CGI and make it available to you. Check with your hosting company if you're not sure. Secondly, you would be well advised to heed the security advice that Matt offers. Formmail, being a popular script, is the target of a lot of exploitation. Some good sense precautions can go a long way to minimize the exposure. It is worth noting that most of the exploits become a problem for your hosting company more than for the website itself.
The second solution is available where FrontPage Extensions are available on the hosting server. The extensions will also need to have been configured to handle email. Again, check with your hosting company if you're not sure. Included in the FrontPage Extensions is a series of capabilities provided by what Microsoft calls "Webbots". If you use a FrontPage Extension aware editor to create your form, the program will provide you the ability to specify an email address to send the form data to as a property of the form. The program then generates the instructions needed to utilize the Webbot to send out your email. This is a very simple method, but does depend on the availability of the extensions and a suitable editing program (such as FrontPage itself.)
Next, I present a solution using one more technology, namely ASP. I have
included a complete sample page with all code in place for you to try out. This solution, being an
ASP solution, will only work for those of you who have your sites hosted on a