University of Hartford

How to make a fill-out-form

To compose an on-line fill-out-form web page and have the results mailed to you, you can use any web page creation tool you like (Netscape Composer, Microsoft Front Page, etc.), or code it by hand (as was done in the following example). To make the data entered onto the form mail-able, you must modify the form definition tag as described below to invoke the web server's forms mailer routine, and add several "hidden" fields that will indicate to the web server just how you want the information mailed.

The code for a very simple form that asks one question, and mails the result to you looks like this:

     <html>
     <form action="/htbin/mailform.exe" method="post">
     <input type="hidden" name="To" value="username@hartford.edu">
     <input type="hidden" name="SMTP" value="mail.hartford.edu">
     <input type="hidden" name="Subject" value="This is a test">
     <input type="hidden" name="File" value="http://uhaweb.hartford.edu/jdoe/thankyoupage.html">
     <H1>Sample e-mail submission form</H1>
     Your E-mail: <input name="From" type="text" size=30 maxlength=30><P>
     Your Name: <input name="thename" type="text" size=30 maxlength=30>
     <input type="submit" value=" Do it! "> <input type="reset" value=" Clear ">
     </form>
     </html>

It produces a screen that looks like this:

Sample e-mail submission form

Your E-Mail:
Your Name:

The parts you need to set up is the form definition tag at the beginning of the form section and add a few hidden fields which must look like the following:

NOTE: The field names are case sensitive. All the names below must be entered exactly as they appear here, and these five fields must be the first five fields of the form. They can be in any order, but they must come before any other fields.
     <form action="/htbin/mailform.exe" method="post">
     <input type="hidden" name="To" value="username@hartford.edu">
     <input type="hidden" name="SMTP" value="mail.hartford.edu">
     <input type="hidden" name="Subject" value="This is a test">
     <input type="hidden" name="File" value="http://uhaweb.hartford.edu/doe/thankyoupage.html">
     Your E-mail: <input name="From" type="text" size=30 maxlength=30> 

where you substitute your own University of Hartford e-mail address for username@hartford.edu on the line containing the To variable, for example:

     <input type="hidden" name="To" value="doe@hartford.edu">

would cause the contents of the form to be mailed to "doe@hartford.edu" when the "Do-it!" button is pressed. Note that this facility will only send mail to your University of Hartford email address in order to prevent unauthorized "phishers" and scammers from using the system for illegal purposes.

The name of the server (SMTP) that the fill-out-form must use to transmit the data must be entered as "mail.hartford.edu" as shown above.

The mail message must have a subject line of your choosing by modifying the line containing the Subject variable. Just put what you'd like in place of "This is a test".

The system needs to send the form filer's web browser to another web page after sending the mail message, perhaps one that says "Thanks for filling out my form" by modifying the line containing the File variable. Just enter the appropriate web address in place of "http://uhaweb.hartford.edu/doe/thankyoupage.html".

Finally, your form must contain a field named "From" into which the person filling out your form may enter their e-mail address, if appropriate. If you provide such a field, and the person fills it in, the e-mail messages you receive from the web page will appear to come from that person, and you can use the REPLY feature of your e-mail program to respond, if you like. If your form does not contain a field named "From", or it does but the person leaves it blank, the script will display an error message to the user. If you don't want to force someone to fill in his or her e-mail address you can make this field hidden and put your address in for the value. Then provide another field name for the user's e-mail address.
Example 1:

     <html>
     <form action="/htbin/mailform.exe" method="post">
     <input type="hidden" name="To" value="doe@hartford.edu">
     <input type="hidden" name="SMTP" value="mail.hartford.edu">
     <input type="hidden" name="Subject" value="This is a test">
     <input type="hidden" name="File" value="http://uhaweb.hartford.edu/doe/thankyoupage.html">
     <H1>Sample e-mail submission form</H1>
     Your E-mail: <input name="From" type="text" size=30 maxlength=30><P>
     Your Name: <input name="thename" type="text" size=30 maxlength=30>
     <input type="submit" value=" Do it! "> <input type="reset" value=" Clear ">
     </form>
     </html>
Example 2:
     <html>
     <form action="/htbin/mailform.exe" method="post">
     <input type="hidden" name="To" value="doe@hartford.edu">
     <input type="hidden" name="SMTP" value="mail.hartford.edu">
     <input type="hidden" name="Subject" value="This is a test">
     <input type="hidden" name="File" value="http://uhaweb.hartford.edu/doe/thankyoupage.html">
     <input type="hidden" name="From" value="doe@hartford.edu">
     Your E-mail: <input name="email" type="text" size=30 maxlength=30>
     Your Name: <input name="thename" type="text" size=30 maxlength=30>
     <input type="submit" value=" Do it! "> <input type="reset" value=" Clear ">
     </form>
     </html>

The resulting e-mail message that you receive would look like the following:

From the first example,
     From:   JSmith@AOL.com
     To:     doe@hartford.edu
     Subj:   This is a test

     thename = John Smith
From the second example,
     From:   doe@hartford.edu
     To:     doe@hartford.edu
     Subj:   This is a test

     email: JSmith@AOL.com

     thename: John Smith

Notes:


University of Hartford Information Technology Services