<http:/cgi-bin/mail-form.tcl?subject=The%20Mail%20Form&name=Bongo>would request a form to be built that starts with the header
The fields that can be set are
The values (recipient and subject) that must be "passed on" to the script that sends the mail are encoded in "hidden" fields in the form.
The other thing that the mail-form.tcl script does is to try to guess the identity of the person sending the mail. It does this by examining the "environment" variables HTTP_FROM, REMOTE_HOST, and REMOTE_ADDR, in that order.
If HTTP_FROM is set, and has an "@" sign in it, it is assumed to be the user's e-mail address. This is true of browsers such as MacMosaic, Netscape and Lynx. With some browsers (e.g., MacMosaic) the user (you) must set their e-mail address manually in an "Options" or "Preferences" dialog. With others (e.g., Lynx), the browser tries to figure it out automatically.
If HTTP_FROM is not properly set, then an "@host" address is generated from the REMOTE_HOST or REMOTE_ADDR values. REMOTE_HOST is preferred, if it set.
A final note: if you decide to copy this script, you will need to take out or modify the bit that points to this documentation!
The form is submitted using the POST method, since the comments could conceivably be quite long.
To adapt it for your own use, you may need to change the $mailprog and $recipient values at the beginning of the script (note that $recipient is the default value, and is used only if one is not supplied from the recipient field on the form.) You may also wish to change the confirmation message, and the "wrapper" of the e-mail message, found in print statements further down in the script.
The script first "unpacks" the values from the POSTing into internal variables. If no comments were entered, it outputs a "you submitted a blank message" response. Otherwise, it picks up the recipient e-mail address and opens a pipe to the mail process. It prints a Reply-to header with the the user's e-mail address, and a Subject header. It then prints the comments in a "wrapper" identifying the user and the specifics of the connection.
After sending the mail, it returns a response screen to the user.
Spencer W. Thomas (spencer@umich.edu)