• Support Center - Using the FormToMail CGI Program •
FormToMail is a CGI program that Wolfpaw's hosting accounts can use to have the responses to their forms sent to them by email. Using the instructions that follow you can easily create forms that:
- send the information your users enter on your form to your email account,
- provide an acknowledgement web page for the user,
- insure the user fills out certain required fields,
- control the order in which the form data is presented in the acknowledgement page and on email to you,
- provide return links on the acknowledgement page, and
- control the background and text colors of the acknowledgement page.
FormToMail is not intended to replace custom built CGI response generators but it is an easy solution that can be implemented without any programming.
The FormToMail CGI program is made available only to Wolfpaw's clients.
The FormToMail CGI program can be added to any web page. Just add the form action command and the hidden HTML tags as described below. The form action command activates the program and the hidden tags allow you to control how it works. The form action command is placed at the start of the form section of your document and defines the CGI program that will be used to process your form. The hidden tags defined below and your form elements are entered after the form action tag. At the end of your form - after all form elements and the submit button be sure you have a closing form tag "</FORM>".
If you would like to see what these HTML tags look like in practice just pull up our 'secure communication form' and use the 'view source' option on your web browser. You'll see exactly where the form action command was placed and how the hidden tags were placed.
Form Action Command:
You'll need to add this HTML line to your form for the CGI program to work. It becomes the opening form tag:
<FORM METHOD="POST" ACTION="/cgi-bin/formtomail.pl" ENCTYPE="x-www-form-encoded">
Specifying the Email Recipient:
The following hidden HTML tag is placed after the form action command and specifies the email addresses of the person who will get the information the user fills out on your form. Here's where you would put your email address but you could have the form response sent to anyone.
<input type=hidden name="recipient" value="firstname.lastname@example.org">
Please note that only one recipient can be specified. That's to keep spammers from using the form.
Specifying the subject:
Here's where you can enter a few words to use for the subject of the email message. You can omit this tag but if you're getting emails from a number of forms you may want use the subject line to distinguish between them. If you don't use this tag the CGI program will use "WWW Form Submission" as the message subject.
<input type=hidden name="subject" value="Your Subject">
Redirection sounds complicated. It works like this: After your user presses the submit button and the information on the form is sent on its merry way one of two things can happen. Either an acknowledgement page will appear or the user will be 'redirected' to another page (e.g. your home page.) The default is to have the CGI program send an acknowledgement page but if you would rather send the user to your home page or elsewhere just add this hidden tag.
<input type=hidden name="redirect" value="http://www.domain.com/index.html">
You can require that certain fields in your form to be filled in before the user can successfully submit the form. Place all field names that you want to be mandatory into this tag. If the required fields are not filled in, the user will be notified of what they need to fill in, and provided with a link back to the form they just submitted.
For example, if you want to require that they fill in the email and phone fields in your form, so that you can reach them once you have received the mail, add the following tag:
<input type=hidden name="required" value="email,phone">
Specifying the Order of Values:
Unless you use this tag FormtoMail will list the information from in random order. This tag allows you to choose the order in which you want this information to appear. You can choose to have the information sorted alphabetically or specify a set order in which you want the fields to appear in your mail message. If you leave this tag out the order will simply default to the order in which the browsers sends the information to the script (which isn't always the exact same order 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.
To sort alphabetically:
<input type=hidden name="sort" value="alphabetic">
To sort by a set field order:
<input type=hidden name="sort" value="order:name1,name2,etc...">
Acknowledgement Page Title:
This tag allows you to specify the title and header that will appear on the acknowledgement page if you do not specify a redirect URL. For example, if you wanted a title of 'Feedback Form Results':
<input type=hidden name="title" value="Feedback Form Results">
Specifying the Return Link URL:
At the bottom of the acknowledgement page you can specify a link to a page you want the user to go to next (e.g. your home page). This tag and the one that follows define the URL of that link and title of the link appearing on the acknowledgement page. This field will not be used if you have the redirect field set.
<input type=hidden name="return_link_url" value="http://www.domain.com/main.html">
Specifying the Return Link Title:
This tag sets the title of the link that will appear on the acknowlegdement page for the link to the page you specify with return_link_url. The two fields will be shown on the resulting acknowledgement page in HTML code as:
The return link title is specified as follows;
<input type=hidden name="return_link_title" value="Back to Main Page">
Setting the Background Image:
This tag allows you to specify a background image that will appear on the acknowledgement page.
<input type=hidden name="background" value="http://www.domains.com/image.gif">
Setting the Background Color:
This tag allows you to specify a background color for the acknowledgement page in much the way you specify a background image. This field should not be set if the redirect tag is.
For a background color of White:
<input type=hidden name="bgcolor" value="#FFFFFF">
Setting the Text Color:
This tag works in the same way as background color, except that it will change the color of your text on the acknowledgement page. Should not be defined if the redirect tag is.
For a text color of Black:
<input type=hidden name="text_color" value="#000000">
Setting the Link Color:
Changes the color of links on the acknowledgement page. Works in the same way as text_color. Should not be defined if the redirect tag is.
For a link color of Red:
<input type=hidden name="link_color" value="#FF0000">
Setting the Visited Link Color:
Changes the color of visited links on the acknowledgement page. Works exactly the same as link_color. Should not be set if the redirect tag is.
For a visited link color of Blue:
<input type=hidden name="vlink_color" value="#0000FF">
Setting the Active Link Color:
Changes the color of active links on the acknowledgement page. Works exactly the same as link_color. Should not be set if the redirect tag is.
For a active link color of Blue:
<input type=hidden name="alink_color" value="#0000FF">