E-mailed Forms


If you are interested in developing fill-in forms whose contents can be e-mailed to you, try using formmail, a freeware perl script we've installed in our server's cgi-bin area.

There is a newer and much improved version of formmail available. The README file for version 1.6 explains its use. Use the examples for version 1.1 that are presented in this page in addition to the version 1.6 README to use version 1.6. To invoke version 1.6, the ACTION field of the FORM tag should contain "http://www.montana.edu/cgi-bin/form-mail/formmail-1.6.pl".

All you have to do, is 1) include 4 fields in your form: recipient, email, realname, and subject and 2) invoke the formmail script in your <FORM> tag's "action" attribute. The formmail script will send the "recipient" an e-mail pairing the names and values of all the fields on your form.

The form tag should look like this:

<form method="post" action="http://www.montana.edu/cgi-bin/form-mail/formmail-1.6.pl">

Within the form, include the following fields:

recipient
a hidden field which specifies who the mail should be sent to, for example:
<input type="hidden" name="recipient" value="www@gemini.msu.montana.edu">

email
the e-mail address of the person filling out the form, supplied in the form, for example:
<input type="text" name="email" size=45>

realname
the full name of the person filling out the form, supplied in the form, for example:
<input type="text" name="realname" size=50>

subject
a hidden field whose value becomes the subject heading on your e-mail, for example:
<input type="hidden" name="subject" value="Web Survey Form">
There is one optional field that you can add:
redirect
a hidden field which specifies where the user is "directed" after the form is submitted: it can be the URL of another html page with a "thank you" note and a back link to the page that invoked the form. For example:
<input type="hidden" name="redirect" value="thankyou.html">

If left out, a default "thank you" message is displayed and the user is returned to the form.

Here's an example:


Example Form

Web Survey Form


Full Name:

Email Address:

How do you like the Web?

Very Much Somewhat Not at All

Please explain your reaction:



Including the source:

<HTML>
<HEAD>
<TITLE>Example Form</TITLE>
</HEAD>

<BODY>
<H1>Web Survey Form<BR> </H1>

<hr>

<FORM METHOD="post" ACTION="http://www.montana.edu/cgi-bin/form-mail/formmail-1.6.pl">

<input type="hidden" name="recipient" value="www@gemini.msu.montana.edu">
<input type="hidden" name="subject" value="Web Survey Form">

Full Name: <br>
<INPUT SIZE=50 NAME="realname">
<br>
Email Address:<br>
<INPUT SIZE=20 NAME="email">
<br>
<p>

How do you like the Web?
<p>
<input type="radio" name="like" value="Very Much">Very Much
<input type="radio" name="like" value="Somewhat">Somewhat
<input type="radio" name="like" value="Not at All">Not at All
<p>

Please explain your reaction:
<p>
<TEXTAREA NAME="opinion" ROWS=3 COLS=60>
</TEXTAREA>
<hr>

<INPUT TYPE="submit" VALUE="Submit Survey">
<Input TYPE="reset" VALUE="Erase Survey">
<p>
</FORM>

<hr>

</BODY>
</HTML>


If you have any questions, feel free to contact your Web Coordinator www@gemini.msu.montana.edu