In one sense, this template is free-form. People who want to send you e-mail can download this template, fill it out, and mail it to you. However, the template will also be used by theTo: firstname.lastname@example.org HEADER LINES Subject: questions three blank line What is your name? [yourname] What is your quest? [quest] BODY What is your favourite colour? [colour]
cgiemailprogram, so before you upload the file to your WWW server, be careful to follow these guidelines:
Now go ahead and upload your e-mail template to the WWW server and look at it with your WWW browser.
Would you like to cross the bridge? Download my "questions three" form and send it to <email@example.com>.Even after you create your WWW form, you will want to leave this link in to increase accessibility to users with disabilities.
From: [email]Here is an example HTML form.
This is a very simple example. Note that the NAME of each input corresponds to what you previously put in the e-mail template. In this example they are email, yourname, quest, and colour. This is the key concept in using cgiemail. Be careful to make them exactly the same; if you put NAME="colour" in your HTML form and [color] (note the spelling difference) in your e-mail template, the input will not show up in the e-mail.<FORM METHOD="POST" ACTION="http://web.mit.edu/bin/cgiecho/wwwdev/cgiemail/questions3.txt"> Your e-mail address: <INPUT NAME="email"><p> Your name: <INPUT NAME="yourname"><p> Your quest: <INPUT NAME="quest"><p> Your favourite colour: <INPUT NAME="colour"><p> <INPUT TYPE="submit" value="Send e-mail"> </FORM>
All types of inputs (radio buttons, etc.) work the same way. Each input needs a NAME, and that name must appear within square brackets in your e-mail template. It's that simple. To get more ideas, see the cgiemail example page.
http://web.mit.edu/wwwdev/cgiemail/questions3.txt \ /\ / `--- Part 1 ---' ` -------- Part 2 ----------'First type the URL of your e-mail template into a web browser and make sure it's correct. Then put the script name in the middle. Usually this is ``/cgi-bin/cgiecho'', but it depends on how your server is configured. On web.mit.edu it happens to be ``/bin/cgiecho'', thus my ACTION looks like this:
http://web.mit.edu/bin/cgiecho/wwwdev/cgiemail/questions3.txt \ /\ /\ / `--- Part 1 ---' script name ` -------- Part 2 ----------'For simplicity, you may leave out part 1, but you must include it if you want to test your form as a local file. If you don't know what that means, just feel free to omit part 1.
If some of your inputs don't seem to be showing up in the processed form, make sure that the inputs have the exact same names in the HTML form as in the ASCII template. E.g. NAME="yourname" in the HTML form and [yourname] in the e-mail template.
If it works, congratulations!
If you are getting a success message but aren't getting mail, you can temporarily use synchronous mail delivery by creating a hidden input named cgiemail-mailopt and giving it a value containing "sync", e.g.
<INPUT TYPE="hidden" NAME="cgiemail-mailopt" VALUE="sync">Be sure to remove this variable when you are done debugging, because it slows things down for the end user and possibly for the mail system.
Note: For release 1.1 and prior, this won't work. Ask your webmaster to install a newer release. Some mailers have a nonstandard extension that sends bounces to an address in an Errors-To: header, so you might try using that header in your template if you're stuck with an old version of cgiemail. However, some errors make this header line unreadable, so there's no way to make absolutely sure the bounce will go to you.
<INPUT TYPE="hidden" NAME="addendum" VALUE="Thank you!">If you are willing to assume that readers of your form are using recent browser software like Lynx 2.6 or Netscape 3.0, then you may put HTML markup into this variable using the appropriate character entities. For example, if you wanted to add
Thank you!then the HTML markup would be
<em>Thank you!</em>meaning you would need the following in your form:
<INPUT TYPE="hidden" NAME="addendum" VALUE="<em>Thank you!</em>">Note that besides being difficult to write, this feature won't work for people using older browser software.
<INPUT TYPE="hidden" NAME="success" VALUE="http://web.mit.edu/">
Note: Start your URL with / or with http://. Otherwise cgiemail will direct your browser to a second invocation of cgiemail, resulting in the error No variable substitutions.
As of release 1.3, there is no way to make this alternate success page contain information the user submitted in the form. This feature is likely to be added in a future release.
If you would like to automatically reject forms with certain inputs left blank, add the prefix ``required-'' to the name of the input in both your HTML form and your e-mail template. Here is an example:In the HTML form:
In the e-mail templateYour name: <INPUT NAME="required-yourname">
Your name: [required-yourname]
In addition to form inputs, your e-mail template can include CGI environment variables simply by preceding the variable's name with a dollar sign. For example,
[$HTTP_USER_AGENT]will put the name of the user's browser and/or gateway in your e-mail message. In order to be respectful of privacy, your HTML form should warn users about any information about them that will be included in the e-mail, e.g. HTTP_USER_AGENT, REMOTE_ADDR.