|
formMailer is a CGI that processes generic HTML form data by processing it
(based on a specified template) and sending it to an Internet email address.
For now this example should get you started. Select 'Document Source' from the
'View' menu to see the HTML souce code for this(assuming
your using Netscape Navigator).
Example #1
The following template file was used in conjunction with the CGI:
Subject: Test of formMailer Version 1.2
From: $from
Reply-To: $from
To: support@AfterNet.COM
X-Mailer: Form2Mail CGI Version 1.2
X-Followup-Page: $followUpURL
X-Server: $myurl
This data was submitted using the HTML form at: $myurl
The following data was submitted:
Email: $from
Number: $number
That's all folks!!
You can put virtually anything you'd like in the template file but
the first 4 lines must start with:
- Subject:
- From:
- Reply-To:
- To:
You'll notice that some words in the template file start with a dollar sign($).
These are 'labels'. The labels will be replaced by information submitted from
your HTML form. If you have a field in your HTML form with a name that
matches a label in the template file, then the value submitted for that field will
replace the label when the template is processed.
In this example for instance there is a label
$from
in the template above. There is also an input field in the HTML form named
from
. When the HTML form is submitted, the value given in the
from
field will replace all instances of
$from
in the template before it is mailed.
In your HTML form you must specify two special fields(with values). These are:
- followUpURL
- The user will be sent the URL specified after the form is submitted.
Example: <input type="hidden" name="followUpURL" value="thankyou.html">
- templateFile
- This is the template file that will be used to format the email sent by the CGI.
Example: <input type="hidden" name="templateFile"
value="/home/help/public_html/formMailer/template.txt">
|