|
Using
CGIMail
Go Back
To
create an HTML form to work with the script "cgiemail"
you will need to use the following form action within your
HTML code:
<form
method="post" action="/cgi-bin/cgiemail/mailtemp.txt">
This
code calls the presinstalled script cgiemail which is
in the server's cgi-bin directory once the web page visitor
clicks the "submit" button. The script cgiemail in
turn calls a text file (or template) called mailtemp.txt
(in the above example, you must create a txt file name
mailtemp.txt and store it under your /htdocs directory). The
template defines the format by which the submitted form
content is to be sent via email.
You
can create the .txt template in a basic text editor
beginning with the following two lines:
To: username@yourdomain.com
Subject: Information Request
Substitute
the desired recipient email address and subject above. Next,
you will need to add ALL field names within the HTML form to
the template in a form similar to the following:
To: username@yourdomain.com
Subject: Information Request
Name [name]
Address [address]
Phone [telno]
As
long as each form field name is contained within brackets
("[ ]") within the template, the email should be
sent successfully and contain all submitted data. We suggest
you use all lowercase field names within your HTML form and
template. If you want a specific web page to load when the
email is successfully sent, such as a thank you note, add
the follow code to your HTML form:
<input
type="hidden" name="success"
value="http://www.yourdomain.com/thanks.html">
Substitute
the URL of the file you wish to load after form data is
submitted. The field name in this case MUST be
"success", but does not need to be added to the
template.
Note
about "required fields"
When
using cgiemail, any fields that are to be required by the
form filler should be named with a "required-"
proceeding the field name. (For example: a phone number
field that is required in order to process your customer's
information may be named "required-phone".)
Why
does my confirmation page fail when submitting my email
form?
Be
sure to properly code the hidden "success" tag in
the form. This should follow the format:
<input
type="hidden" name="success"
value="http://www.your-domain.com/thankyou.html">
Notice
that the url of the confirmation page noted in the value
must be an absolute path. If you specify a relative path
such as: value="thankyou.html", the confirmation
page may return an error.
Also,
the name of the tag must be "success" in order to
function properly. Lastly, be sure that this tag is located
somewhere between the <form> and </form> tags.
Please
click here
for more information about cgiemail.
Go Back
|