How to add a form to your site using CGIEMAIL

How to add a form to your website, a quick and easy way to setup a contact or feedback form.

Login to your control panel an go to CGI Center.

Look for CGI Email...
It says "CGI Email takes the input of an HTML form and converts it to an email format defined by the author of the form."

To install the script click 'CGI Email'

The script will be installed and you'll be taken to http://web.mit.edu/wwwdev/cgiemail/nopath.html which contains more information about working with the script.

How to integrate the script with your website...

Here is a simple contact form...

<FORM METHOD="POST" ACTION="http://www.yourdomain.com/cgi-bin/cgiemail/contact.txt">               
<INPUT TYPE="hidden" NAME="success" VALUE="
http://www.yourdomain.com/thanks_for_your_message.htm">                
<div align="center">                    
<table width="539" border="0" cellspacing="5">                     
<tr><td><div align="right">Your Email Address:</div></td>                         
<td><INPUT NAME="email"></td></tr><tr>
<td><div align="right">Name:</div></td>
<td><INPUT NAME="yourname"></td></tr>
<tr><td><div align="right">Company Name:</div></td>
<td><INPUT NAME="coname"></td></tr>
<tr><td><div align="right">Address / Location:</div></td>
<td><INPUT NAME="address" size="50"></td></tr>
<tr><td><div align="right">Phone Number:</div></td>
<td><INPUT NAME="phone"></td></tr>
<tr><td><div align="right">Subject: </div></td>
<td><INPUT NAME="submess" size="30"></td></tr>
<tr><td valign="top"><div align="right">Message:</div></td>
<td><textarea name="message" cols="50" rows="10"></textarea></td></tr>
<tr><td height="30">&nbsp;</td>
<td valign="top"><INPUT name="submit" TYPE="submit" value="Send Message"></td></tr>
</table>
</div>
</FORM>

Copy the above code to your page, make sure to change yourdomain.com to the name of your website.

Then you need to create a file that formats the data and specifies where it should be sent, we have called the following file contact.txt in the above code (create it and upload it to your /public_html/ folder). You'll need to set the email address where you want the information sent to, you'll also notice that the input names match the fields in the form, you can easily change them if you need to, just follow the same format. The contents of contact.txt should be...

To: user@yourdomain.com                   
Subject: Message submitted on Website
                                                
Name               [yourname]
Company Name   [coname]
Address    [address]
Phone Number   [phone]
Subject of Message  [submess]
Message               [message]


You also need to create a sucess page for your visitor to be redirected to after submission of the form, in the example above we've called it thanks_for_your_message.htm you can change that to whatever you like, but you must create a success page or the form won't work.

  • 58 Users Found This Useful
Was this answer helpful?

Related Articles

Using CGIEmail - Example 2

  This tutorial will teach you how to use the CGIEmail script that is pre-installed with...