Home   |   Products   |   Order   |   Support   |   ? !1 UK Web Hosting
 

FormMail CGI
FormMail is a generic WWW form to e-mail gateway, which will parse the results of any form and send them to the specified user. This CGI has many formatting and operational options, most of which can be specified through the form, meaning you don't need any programming knowledge or multiple CGIs for multiple forms. This also makes FormMail the perfect system-wide solution for allowing users form-based user feedback capabilities without the risks of allowing freedom of CGI access.

Installation
To install the FormMail CGI on your Virtual Server, connect to your Virtual Server via Telnet or SSH and do the following:

% vinstall formmail

This command installs two files, formmail.pl and formmail.README.txt, into your ~/www/cgi-bin directory.

Configuration
Set the referer information such that only your server will have privileges to use the FormMail CGI. Near the top of the formmail.pl file you will find the following line:

@referers = ('YOUR-DOMAIN.NAME','YOUR.IP.ADD.RESS');

Substitute your domain name and Virtual Server IP address for the values YOUR-DOMAIN.NAME and YOUR.IP.ADD.RESS respectively.

In addition, you must also add the list of domains that will receive e-mail as recipients to the @ok_recipients array (just below the @referers array). This will prevent FormMail from sending unauthorized messages to a recipient other than the intended recipient.

@ok_recipients = ('@YOUR-DOMAIN.NAME$', '@SUBHOST-DOMAIN.NAME$');

Substitute your domain name and all subhosted domains on your server if you wish them to be able to use FormMail also.

Usage
Create a form that you would like the contents mailed to some address. The form should include the following field (at the very least):

  • recipient = specifies who mail is sent to

Other optional fields can also be used to enhance the operation of FormMail for you site, for example:

  • subject = specify the subject included in e-mail sent back to you
  • email = allow the user to specify a return e-mail address
  • realname = allow the user to input their real name
  • redirect = URL of page to redirect to instead of echoing form input
  • required = list of field names that are required input (comma delimited)

Several other fields are supported. See the formmail.README file for a complete presentation of the supported fields.

For example, the HTML source for your form may look like this:

<form method="POST" action="/cgi-bin/formmail.pl">
<input type="hidden" name="recipient" 
       value="order@yourdomain.com">
<input type="hidden" name="subject" 
       value="Order Request">
<input type="hidden" name="required" 
       value="realname,email,phone">
Please Enter Your Name:<br>
<input name="realname" size="40">
<p>
Please Enter Your Email Address:<br>
<input name="email" size="40">
<p>
Please Enter Your Phone Number:<br>
<input name="phone" size="40">
<p>
.
.
.
<input type="submit" value="Submit">
<input type="reset" value="Reset">
</form>

Tip
One useful modification of the FormMail CGI is to have it "autorespond" to the client filling out the form. You can do this by simply uncommenting out the call to the autorespond function located near the top of the CGI. The autorespond function is placed at the end of the file and can be modified to suit your needs.


Site Map  |  Contact Us!
Copyright © 1998-2001 Bright Builders, Inc. All rights reserved.
Last Modified: Fri Mar 30 18:27:49 2001 GMT
Page Built: Mon Jul 2 19:57:47 2001 GMT

   
A L S O  S E E
· PGP FormMail
· Virtual Server Help