|
FormMail
FormMail is a cgi
script used to process information sent by your visitors when they fill
out a form on your site. The information is sent to the email address you
specify. To use FormMail, you need to create a form on one of your web
pages, configured as follows.
Configuring Your
Form
The first line of code
for your form should be:
<form
method="post"
action="/cgi-sys/formmail.pl">
There is only one form
field that you must have in your form for the script to work correctly,
and that is the recipient field. The recipient field allows you to specify
where you want the results of your form to be mailed.
<input
type="hidden"
name="recipient"
value="youremail@yourdomain.com">
Replace youremail@yourdomain.com
with your particular e-mail address. This must be an email address at your
own domain. If you need to have the form sent to an outside email address,
please forward it through your Email
Manager.
Optional Form Fields
SUBJECT - The
subject field will allow you to specify the subject that you wish to
appear in the e-mail that is sent to you once your form is submitted by
the user. If you do not use the subject field, the e-mail will come
through with a default subject of "WWW Form Submission"
To choose your own
subject, use the following code:
<input
type="text"
name="subject"
value="Your
Subject"
size="20">
Replace "Your
Subject" with what you want your subject to be. You can also
modify the size value. This signifies the length of the text box as
it appears on your form.
EMAIL - This
form field will allow the user to specify their return e-mail address. It
will also indicate to you where the e-mail originates from when you
receive it in your e-mail program.
<input
type= "text"
name="email"
size="20">
As with the previous
explanation, the size indicates the length of the text box on your form.
You can modify this as necessary.
REALNAME - The
realname form field will allow the user to input their real name. This
field is useful for identification purposes and will also be put into the
From: line of your message header.
<input
type="text"
name="realname"
size="20">
REDIRECT - Once
the user submits the form, if you wish to redirect them to different URL,
you can use this hidden variable to send them to a pre-made HTML page
(such as thanks.html)
<input
type="hidden"
name="redirect"
value="http://www.yourdomain.com/thanks.html">
REQUIRED - You
can require that certain fields in your form be filled in before it can be
successfully submitted. Simply place all field names that you want to be
mandatory, separated by a comma, into this field. If the required fields
are not filled in, the user will be notified of what they need to fill in,
and a link back to the form they just submitted will be provided.
<input
type="hidden"
name="required"
value="email,phone">
Replace email,phone
with the actual list of fields that you wish to be required. The
field names are case sensitive and should match exactly what you named
them in the html code of your form.
MISSING_FIELDS_REDIRECT
- If a user does not fill in all the required fields of your form,
they will be taken to a default page which tells them which fields are
missing. If you wish to create your own custom page, you can add
code to the form to redirect the user to your page when an error occurs.
<input
type="hidden"
name="missing_fields_redirect"
value="http://your.host.com/error.html">
Replace the value field
with your domain name and the location of your error file.
ENV_REPORT - This
code allows you to extract environment variables from the user upon
submission. It comes in handy if you want to know what browser the visitor
was using, what domain they were coming from, or any other such
attributes.
The most common
variables are:
REMOTE_HOST - Sends the hostname making a request.
REMOTE_ADDR - Sends the IP address of the remote host making the
request.
HTTP_USER_AGENT - The browser the client is using to send the
request.
<input
type="hidden"
name="env_report"
value="REMOTE_HOST,
HTTP_USER_AGENT">
For more information on
environment variables, visit: http://www.cgi-resources.com/Documentation/Environment_Variables/
SORT - This
field allows you to choose the order in which your variables appear in the
e-mail that FormMail generates. You can choose to have the field sorted
alphabetically or specify a set order in which you want the fields to
appear in your mail message. If you leave this field out, the order will
simply default to the order in which the browser sends the information to
the script (which is usually the exact same order as they appeared in the
form.) When sorting by a set order of fields, you should include the
phrase "order:" as the first part of your value for the sort
field, and then follow that with the field names you want to be listed in
the e-mail message, separated by commas.
<input
type="hidden"
name="sort"
value="order:name1,name2,
name3,etc...">
Replace
name1,name2,name3,etc... with your own field names.
PRINT_CONFIG - This
allows you to specify which of the config variables you would like to have
printed in your e-mail message. By default, no config fields are printed
to your e-mail. The important form fields, like email and subject are
included in the header of the message; however you may wish to have them
printed in the body as well. The config fields that you wish to have
printed should be in the value attribute of your input tag separated by
commas.
For example, if you
wanted to print the email and subject fields in the body of your message,
you would place the following form tag:
<input
type="hidden"
name="print_config"
value="email,subject">
PRINT_BLANK_FIELDS -
This code allows you to request that all form fields are printed in
the return HTML, regardless of whether or not they were filled in.
FormMail defaults to turning this off, so that unused form fields aren't
e-mailed. If you want to include them, use the following code:
<input
type="hidden"
name="print_blank_fields"
value="1">
TITLE - This
field allows you to specify the title and header that will appear on the
resulting page if you do not specify a redirect URL. If you wanted a title
of 'Feedback Form Results' you would use the following code:
<input
type="hidden"
name="title"
value="Feedback
Form Results">
RETURN_LINK_URL-
This field allows you to specify a clickable URL that will appear on
the page that is generated once the form has been submitted. This field
will not be used if you have the redirect field set.
<input
type="hidden"
name="return_link_url"
value="http://yourdomain.com">
RETURN_LINK_TITLE
- This is the title that will be used to link the user back to the
page you specify with return_link_url. The two fields will be shown
together on the resulting form page as a highlighted hyperlink like the
one below. (The following example assumes that your return_link_title was
set to "Feedback Form Results")
BACKGROUND - This
field allows you to specify a background image that will appear if you do
not have the redirect field set. This image will appear as the background
to the form results page.
<input
type="hidden"
name="background"
value="http://yourdomain.com/image.gif">
Replace yourdomain.com
with your domain name, and image.gif with the name of your image.
BGCOLOR -
This field allows you to specify a background color for the form results
page, much in the same way you specify a background image. This field
should not be set if the redirect field is. For a background color of
white, you would use:
<input
type="hidden"
name="bgcolor"
value="#FFFFFF">
TEXT_COLOR - This
field works the same way bgcolor does, except that it will change the
color of your text. For black text, you would use:
<input
type="hidden"
name="text_color"
value="#000000">
LINK_COLOR - This
changes the color of the hyperlink on the resulting page. It works
in the same fashion as text_color, and also should not be used if you are
using redirect. The following example calls for a red link.
<input
type="hidden"
name="link_color"
value="#FF0000">
VLINK_COLOR - This
changes the color of visited links on the resulting page. It works exactly
the same as link_color. For a visited link color of blue, you would
use:
<input
type="hidden"
name="vlink_color"
value="#0000FF">
ALINK_COLOR -
This changes the color
of active links on the resulting page. An active link is shown when the
mouse is moved over the link. It also works exactly the same as link_color.
For an active link color of blue, you would use:
<input
type="hidden"
name="alink_color"
value="#0000FF">
|