Form Script (CGI Email)
Our form script, called CGI Email, enables you to incorporate a form into your Web page that users can fill out and then submit to you via email. For example, you could have a simple order form that prompts your visitors for the necessary information and then sends the information to your email address.
Using the CGI Email script requires that you complete several different tasks:
- Create the text file that will be emailed to you upon successful form submission.
- Define the variables you want to use within that text file. These variables will be automatically populated with the data your visitors supply in the corresponding form fields.
- Create an HTML form that specifies the post action and includes input fields for each defined variable.
- Upload the text file and HTML file to the proper locations.
To customize and incorporate the CGI Email script:
Using a text editor such as Notepad, create a text file.
Type the following text on the first three lines of the text file.
To: youremailaddress@yourdomain.com
From: [email]
Subject: Order from [name]
This text specifies the email address to which you want the form submitted as well as defines the [email] and [name] variables. Anything in brackets will be replaced with the values specified for each corresponding input field in your HTML file. Text not contained within brackets will display "as is" in the email you receive. It is for descriptive purposes only.
Insert a blank line after the [name] variable.
Add and label additional variables as necessary. For example, you may want to collect visitors' contact information or details about the product they are requesting.
Save the file as a plain text file and then upload it to your/www directory.
In the Web page where you want the form to appear, create an HTML form and specify the form's action attribute as follows:
action="/cgi-bin/cgiemail/yourtextfile.txt">
Where yourtextfile is the name of the text file you saved in step 5.
Insert an input field for each of the variables in your corresponding text file. The name attribute of the <input> element must exactly match the bracketed text in the text file for the variable to be replaced with the input data. The following HTML provides an input field for each variable defined in the corresponding text file.
<form method="post"
<input type="text" name="name">Your name:
<input type="text" name="email">Your email address:
<input type="text" name="phone">Your phone number:
<input type="text" name="address">Your address:
<input type="text" name="product">Product to order:
...To redirect the visitor to another page, for example a confirmation page, immediately after successful submission of the form, insert the following line in your form:
<input type="hidden" name="success" value="http://yourdomain.com/yourpage.html">
Where yourdomain is your domain name and yourpage is the name of the page to which you want to redirect users.
Save and upload your HTML file as necessary.
Using the CGI Email script with the secure server
If you are using the CGI Email script via a secure server, you must ensure that the URL specified by the form's action attribute references your secure server: If you do not know the secure server you should use, contact our Support team
<form method="post" action="https://secureserver.net/yourdomain/cgi-
bin/cgiemail/yourdomain/yourtextfile.txt">Where secureserver is the name of the secure server you are using, yourdomain is your domain name and yourtextfile is the name of the text file you saved in step 5 of the previous section.
Example CGI Email code
<form method="post" action="/cgi-bin/cgiemail/yourtextfile.txt">
<input type="text" name="name">Your name:
<input type="text" name="email">Your email address:
<input type="text" name="phone">Your phone number:
<input type="text" name="address">Your address:
<input type="text" name="product">Product to order:
<input type="hidden" name="success" value="http://yourdomain.com/
yourpage.html">
<input type="submit" value="Submit">
<input type="reset" value="Reset">
</form>