Personal Mail-Back Script

Background

HTML includes the ability to include a form in your pages. To process the information, each form required a program, or script, on the server to accept the information and the form and do something with it. The most common action to take is to e-mail the results to a human.

mailback.cgi is a generic script to e-mail the contents of a form to a WestNet e-mail address. It will ONLY mail to WestNet addresses, so if you are not a WestNet customer you can not use this script in your pages.

This document explains how to use mailback.cgi in your personal home pages. Please note that this script and documentation are provided as a courtesy and are not supported features. If you require assistance, please post a question in one of the local Westnet newsgroups, such as Westnet.questions.

Usage

First, you must write a form. Any book on HTML should have a chapter on forms. On-line information is also available at the NCSA's web site. Please read this before proceeding, as we assume you know how to make a form. If you know HTML forms and just want a quick example, take a look at this example form.

mailback.cgi requires three things in your HTML form. First, you must specify the script in your FORM definition, with a method of POST, as follows.:

<FORM METHOD="post" ACTION="/cgi-bin/mailback.cgi">

Next, we define two hidden fields, which will tell the script (1) where to e-mail the form data, and (2) what to show the user after the form data has been taken. Your username is placed in a field mailto as follows:

<INPUT TYPE="hidden" NAME="emailto" VALUE="username">

Replace username above with your WestNet username. In the same way we define the HTML page to be shown after the data is accepted. Use a line like this:

<INPUT TYPE="hidden" NAME="success" VALUE="/~chris/itworked.html">

This would load a file called itworked.html from my person web space (ie: my public_html directory).

That's it. When someone submits your form, a list of all the variables and the corresponding values will be e-mailed to your account. If you haven't already, now would be a good time to look at the example form.


Back to Home Page Instructions