Quantcast

Web Hosting, Web Design Guides

Singapore Web Hosting

Home » Support » Web Hosting User Guide



Singapore dedicated servers


Web Hosting User Guide - HTML and CGI Script - Formmail

 

On This Page:
     
:: FormMail Overview
     :: Using FormMail
     ::
Optional Form Fields
     
:: Other Form Fields
     
:: Using FormMail Securely

Other Resources:
     :: FormMail Home Page
     
:: FormMail FAQ



FormMail Overview

FormMail is a script, which takes the results of any form and sends them to a specified email address. You do not need to know how to program and you do not have to use multiple scripts for multiple forms.

You can alter the behavior of FormMail by using other fields in your form. The optional form fields are listed below.



Using FormMail

1. Create a form with any decent web page creation software.

2. Within the form tag add the following hidden field.

<input type=hidden name="recipient" value="email_address">

email_address - Enter the email address where you want the results of the form to be sent.

3. Change the action line of the form to match the code below.

<form method="POST" action="/cgi-bin/formmail.pl">



Optional Form Fields

NOTE: In the descriptions below, the "email" refers to the email that is sent to the specified email address with the results of the form.

Field: subject
The subject field will allow you to specify the subject that you wish to appear in the email that is sent to you after the form has been filled out. If you do not have this option turned on, the script will automatically enter "WWW Form Submission" as the subject.
Code:
If you wish to choose what the subject is:
<input type=hidden name="subject" value="email_subject">

To allow the user to choose a subject:
<input type=text name="subject">

Field: email
This form field will allow the user to specify their return email address. This will be put into the "From:" field of the email.
Code:
<Input type=text name="email">

Field: 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 the email.
Code:
<Input type=text name="realname">

Field: sort
This field allows you to choose the order in which you wish your variables to appear in the email. You can choose to have the field sorted alphabetically or specify a set order.

By leaving this field out, the order will simply default to the order in which the browser 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 email message, separated by commas.
Code:
To sort alphabetically:
<input type=hidden name="sort" value="alphabetic">

To sort by a set field order:
<input type=hidden name="sort" value="order:field1,field2,etc...">

Field: redirect
If you wish to redirect the user to a different URL, you can use this hidden variable to send them to an existing HTML page.
Code:
To choose the URL where the user will end up:
<input type=hidden name="redirect" value="redirect_url">

To allow the user to specify the URL where he wishes to travel:
<input type=text name="redirect">

Field: required
You can now require that certain fields in the form are filled in before the user can successfully submit the form. If the required fields are not filled in, the user will be notified of what they need to fill in, and they will be provided with a link back to the form.
Code:
<input type=hidden name="required" value="required_field1,required_field2">

Field: env_report
This field allows you to have Environment variables included in the email. This is useful if you wish to know what browser they were using, what domain they were coming from, or any other attribute which is associated with environment variables. The following is a short list of valid environment variables that might be useful:

REMOTE_HOST - Provides the name of the remote host making a request.

REMOTE_ADDR - Provides the IP address of the remote host making the request.

HTTP_USER_AGENT - Provides the browser the client is using to send the request. General format: software/version library/version.

Code:
<input type=hidden name="env_report" value="environment_variable1,environment_variable2">

Field: title
This form field allows you to specify the title and header that will appear on the confirmation page if you do not specify a redirect URL.

Code:
<input type=hidden name="title" value="title">

Field: return_link_title
This is the title of the link on the confirmation page that will take the user to the page you specify with the field "return_link_url".

Will not work with the "redirect" field.

Code:
<input type=hidden name="return_link_title" value="link_title">

Field: return_link_url
This is the URL of the link on the confirmation page whose title you specified with the "return_link_title" field.

Will not work with the "redirect" field.

Code:
<Input type=hidden name="return_link_url" value="page_url">

Field: background
This form field allows you to specify a background image for the confirmation page.

Will not work with the "redirect" field.

Code:
<Input type=hidden name="background" value="http://yourdomain.com/image.gif">

Field: bgcolor
This form field allows you to specify a background color for the confirmation page.

This field will not work with the "redirect" or "background" field.

Code:
<input type=hidden name="bgcolor" value="hexidecimal_color">

Field: text_color
This field will specify the color of the text on the confirmation page.

Will not work with the "redirect" field.

Code:
<input type=hidden name="text_color" value="hexidecimal_color">

Field: link_color
This field will specify the color of the links on the confirmation page.

Will not work with the "redirect" field.

Code:
<input type=hidden name="link_color" value="hexidecimal_color">

Field: vlink_color
This field will specify the color of the visited links on the confirmation page.

Will not work with the "redirect" field.

Code:
<input type=hidden name="vlink_color" value="hexidecimal_color">

Field: alink_color
This field will specify the color of the active links on the confirmation page.

Will not work with the "redirect" field.

Code:
<input type=hidden name="alink_color" value="hexidecimal_color">



Other Form Fields

Any other form fields that appear in your script will be mailed back to you and displayed on the confirmation page if you do not have the "redirect" field set.



Using FormMail Securely

1. Visit the FormMail website and download a copy of the script.

NOTE: Be sure to download the UNIX version.

2. Upload the "formmail.pl" file into your local "/cgi-bin" directory.

3. Change the permissions to "chmod 755".

It will look something like this:

http://yourdomain/cgi-bin/formmail.pl

yourdomain - Enter your domain name without the extension.




Related Information

What is HTML
Adding Images
Hyperlinks and Anchors
Cascading Style Sheets
Meta Tags


CGI Scripts

Installing Counter

 

 

 

 






 

Singapore Web Hosting | Singapore Web Design | Budget Hosting | Email Hosting | Web Hosting | Web Design | VPS Hosting | Dedicated Server | Domain Name
Internet Marketing
| IT Support and Computer Maintenance | Managed Hosting | Corporate Branding | Web Hosting Articles | Web Design Articles

Singapore Domain | Legal Info | Privacy | TOC | Sitemap | Resources | Business Directory
Copyrights © 1997-2009 HostSG - Singapore Web Hosting Company