cgiemail (version 1.1)


Homepage: http://web.mit.edu/wwwdev/cgiemail/
User Guide: http://web.mit.edu/wwwdev/cgiemail/user.html

To use cgiemail, you must first construct a form for site visitors to use to send you information. If you have a Virtual or REAL Domain, the opening tag of the form must be:

<FORM METHOD="POST" ACTION="/cgi-sys/cgiemail/template.txt">

If you do not have a domain (standard domain), you must use:

<FORM METHOD="POST" ACTION="/cgi-sys/cgiemail/username/template.txt">

In either case, cgiemail will automatically find your Web directory and look there (or in a subdirectory you specify) for the template file.

The template file that you create must be a plain ASCII text file (do not upload it in binary mode), and must have the extension .txt. The template file goes in your Web directory along with other Web files.

The template file starts with mail headers, which must be followed by a blank line before the body of the message being sent. If you do not follow this convention, your mail will be corrupted or will not reach you. The two most important headers are To: and Subject:, so always put those first. Here is a sample template file:

To: strangeman@chasm.big
Subject: questions three

What is your name?              [yourname]
What is your quest?             [quest]
What is your favourite colour?  [colour]

The HTML that uses this template would resemble:

<FORM METHOD="POST" ACTION="/cgi-sys/cgiemail/template.txt">
Your name: <INPUT NAME="yourname">
<BR>
Your quest: <INPUT NAME="quest">
<BR>
Your favourite colour: <INPUT NAME="colour">
<P>
<INPUT TYPE="submit" value="Send E-Mail">
</FORM>

After the mail has been delivered, the visitor will see a simple "Success!" page, and nothing more. To add an optional one line comment to this result page, add this field to your HTML file:

<INPUT TYPE="hidden" NAME="addendum" VALUE="your message here">

Or better yet, include this field to generate a permanent redirect to a page of your own design:

<INPUT TYPE="hidden" NAME="success" VALUE="your URL here">

To require that a particular field of the form be filled out, change its name to have a leading required- in both the HTML file and the template.

You can include environment variables in the e-mail by putting them in the template file as field names, with a leading $ sign. For example:

User's browser was: [$HTTP_USER_AGENT]

More information on options and special configurations is available at the homepages listed at the top of the page. It should be noted that this form-emailer handles things using a different approach. The template scheme of doing things may be a little hard to comprehend at first so just use trial and error until you get it right.