Tutorials Check Email My Account
Home Web Hosting Domain Sign Up FAQ Contact Us
Toll Free No. : 888.638.9963    

Register and park a new domain for as low as US$20 a year Price Chart »
Reserve A Domain Now:
Contact Us On-line:
Web Messaging

In Vancouver, Canada
Other Areas:
CGI Form Mail Installation

Setting up CGI FormMail (EM)

Matt Wright's FormMail Version 1.9s (Security Enhanced Version):

* This tutorial is only for subscribers of the DH Unix Plus, DH Unix Pro or Ultra Web Hosting services.

The common gateway interface (CGI) is a standard way for a web server to pass a web user's request to an external application program for processing and (where applicable) to receive back the data results. A CGI FormMail allows data to be submitted through an HTML form and that data to be processed by a form handler application which typically sends the results to a predefined email address or file location.

If you are creating a website and want a CGI application to be run, you would specify the name of the application in the uniform resource locator (URL) that you code in an HTML file. This URL can be specified as part of the FORMS tags if you are creating a form. For example, you might code:

< FORM METHOD=POST ACTION=http://www.yourdomain.com/cgi-bin/FormMail.pl >

and the server at "yourdomain.com" would pass control to the CGI application called "FormMail.pl" to process the entered data and return a confirmation message. (The ".pl" indicates a program written in PERL but other languages could have been used.)

Important: Clients should only use this security enhanced version of Matt Wright's FormMail Version 1.9 to prevent script hijacking and possible SPAM abuse.

Create your form page in HTML. There is no limitation to your form design.

Download the script FormMail Version 1.9s, save it to a temporary directory on your computer, then unzip the files.

Open the FormMail.pl file in a plain text editor such as Notepad and change the value of the recipient_addresses variable on line 57. Change the recipient address to the email address that the FormMail results will be sent to. Note that the only thing that should be between the single quotes (' ') is a single email address.

(If the recipient email address is an email address under the website domain name, click here)

Also make sure the paths to Perl and Sendmail are correct, they should look exactly as in the screenshot here. By default these paths are set correctly for you if you download the script from our server.

Edit the HTML code of your form page and define the FORM ACTION to execute the FormMail.pl script located at /cgi-bin/FormMail.pl and make sure the FORM METHOD is "POST".

To do so, you should add the highlighted line to your HTML form.

Important: The input tags which are defined as hidden is information used by the FormMail script only and will not show up in a browser when the page source code is viewed. The hidden value of recipient in the HTML form MUST MATCH the recipient_addresses variable you defined as the recipient address in the FormMail.pl script in order for the script to send email.

Upload the FormMail.pl script using ASCII mode to the CGI-BIN folder (/var/www/cgi-bin) of your account. Be sure to switch back to Binary mode before uploading other files.

Change FormMail.pl script file permissions to the following settings using your FTP software.

  • Owner: Allow Read, Write, and Execute
  • Group: Allow Read and Execute
  • Others: Allow Read and Execute

To change file permissions using CuteFTP, select the file by clicking on it once on the remote system side and then right-click on the file to bring up the option menu and select CHMOD.

To assign the correct file permissions under Owner check Read, Write, Execute, under Group check Read, Execute and under Other check Read and Execute. The manual value of the permission is 7-5-5.

Congratulations. You have successfully set up your FormMail script.




If you require additional assistance, please feel free to contact our customer service team: https://#site_domain_name#/ContactUs/

Back to Tutorials Page

Legal Privacy