Missouri State University

Create an Email Form Outside Web Press

Formmail.asp is a script that provides a generalized form processor to send form results to an email address.

Formmail.asp can be used simply by adding a few tags to an existing form. Follow the tags described below with the rest of the form markup. Notice that since these input types are "hidden," the user will not see any evidence of these tags when viewing the document, although they can see them by viewing the HTML source.

Required Fields

For this script, the form tag should look like this:

<form method="post" action="https://www.missouristate.edu/cgi-bin/formmail.asp">

Then the following tag must be added for the script to function properly:

<input type="hidden" name="sendto" value="yourname@missouristate.edu" />

This required field tells who to send the mail to. Replace the value field with the email address that should receive the form response. The script will only send results to missouristate.edu email addresses.

Optional fields

The following fields are optional and do not need to be included in your forms.

Return Document

The "rdoc" field may be filled in with the absolute URL of the document that is to be returned when the form is submitted. If this field is omitted, then the default "thank you" page will be used.

<input type="hidden" name="rdoc" value="http://www.missouristate.edu/deptname/thanks.html" />

Subject

The third "subject" field tells what words to use as the subject line of the email message:

 <input type="hidden" name="subject" value="Form Response" />

Sorting

The "sortkeys" field tells the program to sort the results alphabetically by field name before emailing them:

 <input type="hidden" name="sortkeys" value="true" />

So, if you'd like the results returned in a specific order, you can add letters to the beginning of the field names. For example, instead of naming a field name "Text," your could name it "aText" so that it would be returned first.

Reply address

When form results are emailed, they'll be marked as coming from webserver@missouristate.edu. You may want to reply to the form results, but not have it go back to the web server. To do this, you can change the reply-to address in the email form:

<input type="hidden" name="replyto" value="emailaddress@missouristate.edu" />

Replace the value field with the email address where you wish replies to be sent. This feature usually works when the form emails are processed through Outlook, but it may not work with other email clients.

Sample form code

<form method="post" action="https://www.missouristate.edu/cgi-bin/formmail.asp">

<input type="hidden" name="subject" value="Form Response" />
<input type="hidden" name="sendto" value="yourname@missouristate.edu" />
<input type="hidden" name="sortkeys" value="true" />

<p><label for="fp3">Name:</label>
<input name="aName" value size="40" id="fp3" /></p>

<p><label for="fp2">Email address:</label>
<input name="bEmail" value size="50" id="fp2" /></p>

<p><label for="fp1">Comments:<br /></label>
<textarea name="cComments" rows=5 cols=60 id="fp1"></textarea></p>

<p><input type="submit" value="Send" /></p>
</form>

Sample form

1000 characters remaining.