Forms

From HE FAQ
Revision as of 12:21, 12 August 2010 by Coryr (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

This information only pertains to Hurricane Electric's Shared Web Hosting package. There may be different information in our other categories.

This document demonstrates the use of the FormMail.pl CGI script. Please note that while we're unable to provide detailed support for this script (for reasons such as bugs, compatibility issues, potential vulnerabilities, etc), we are able to provide this basic tutorial on setup for HTML forms on your Hurricane Electric hosted site. If you have any questions regarding the script itself, please see the NMS Support Page.

Ingredients

  • The script.

You can download the NMS FormMail script from the NMS download page. Be sure to grab the 'compat' version.

Prior to putting the script on your site, you'll need to configure it. Configuration is fairly simple, as it takes place entirely in the second 'page' of the script.

Once you've downloaded the .zip file from the above link, open it up, then open FormMail.pl inside of your favorite text editor (we recommend 'notepad.exe' in Windows). Scroll down until you see the following:

BEGIN
 {
   $DEBUGGING         = 1;

This is the beginning of the section you'll be editing. Here, you will edit the following lines:

$max_recipients    = 1;
$mailprog          = '/usr/sbin/sendmail -oi -t';
$postmaster        = 'you@example.com';
@referers          = qw(example.com www.example.com);
@allow_mail_to     = qw(you@example.com); 

$style             = '';

You'll need to replace 'you@example.com' with your email address, and 'www.example.com' with your Hurricane Electric hosted website. The small change in '$mailprog' is important, so make sure you don't skip over it.

  • The form.

This is your standard HTML form with an ACTION which invokes the FormMail.pl CGI script.

 <form METHOD="POST" ACTION="http://example.com/cgi-bin/FormMail.pl">
 
 <pre>
 Email Address: <input name="email"><p>
    Real Name: <input name="realname"><p>
    Shoe Size: <input name="shoe-size"><p>
 </pre>
 
 <ul>
 <li> <input type="checkbox" name="merchandise" value="2101">2101 - Blue Shoes
 <li> <input type="checkbox" name="merchandise" value="2102">2102 - Red Shoes
 <li> <input type="checkbox" name="merchandise" value="2103">2103 - Yellow Shoes
 <li> <input type="checkbox" name="merchandise" value="2104">2104 - Green Shoes
 <li> <input type="checkbox" name="merchandise" value="2105">2105 - Black Shoes
 </ul>
 
 <input type="submit" value="Order Now"> (Don't worry, this will only show you what an email message would look like.)
 <input type="hidden" name="addendum" value="This is the default success message.  You may also specify a URL as the 'value' of a 'hidden' input named 'redirect' to cause FormMail.pl to jump to that URL if email is successfully sent.">
 
 <input type="hidden" name="required" value="email,realname,shoe-size">
 
 </form>

Differences from cgiemail

Many of our long time customers will remember cgiemail, and wonder where it has gone. It's still exists for our legacy users, but we're recommending away from cgiemail, as it hasn't been supported for a very long time, and vulnerabilities do exist.

Required form entries are now designated inside a small array, as listed in the form above.

'From' addresses no long require lengthy procmail recipes! You can now simply use 'email' and 'realname' in the form, and the script will take care of the rest.

For information on what all the names and fields do, please see the README file inside the FormMail .zip file.