LONESTAR

The #1 Choice for Web Hosting
Support Forum
System CGI
cgiemail


cgiemail (version 1.5)
Homepage: http://web.mit.edu/wwwdev/cgiemail/
User Guide: http://web.mit.edu/wwwdev/cgiemail/user.html
Modifications Required: none
Optional Modifications: None recommended.

cgiemail is a CGI to E-Mail gateway. It accepts the results of a form, and uses a template file to build and construct an e-mail message containing those results.

To use cgiemail, you must first construct a form for site visitors to use to send you information. The opening tag of the form must be:

<FORM METHOD="POST" ACTION="/cgi-sys/cgiemail/username/template.txt">
cgiemail will automatically find your Web directory and look there (or in a subdirectory you specify) for the template file.

While you are testing your form, you should substitute cgiecho for cgiemail in the FORM tag. This will simply print the mail to your browser's screen, instead of actually sending anything.

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: somebody@somehost.com
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 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 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]

Return to System CGI


Search:
Still need help? E-Mail us!

(888) 855-9321

Sign Up!     Service Plans     Guarantee     Contact Us
Home
12112 Frank Cordova Cir.
El Paso, Texas 79936-4488
info@lstar.net
Tel./Fax (915) 203-0193