WebHostingSolutions.com
For the World's Most Important Web Site - YOURS!

VPS v2 Support Documentation

FormMail CGI

FormMail is a CGI program designed to generate e-mail based on the input from an HTML form.

Installation

To install FormMail on your Virtual Private Server, connect to your server via SSH, su to root, and run the following command:

# vinstall formmail

The FormMail script and additional files that contain various help information will install in the /usr/local/FormMail directory. A FormMail.pl file will also be placed in the /www/cgi-bin directory. If you do not want the FormMail.pl file in this directory, either remove it or move it to the desired cgi-bin directory.

Before executing the script, open the file FormMail.pl and modify the following fields under the USER CONFIGURATION SECTION.

  • Find the @referers line and replace the information inside the parentheses with your own server's domain name(s) and IP address. You can leave the localhost value.

  • In the @allow_mail_to line, remove the original email addresses and put either the domain, or a full email address for every domain that should be allowed to receive email messages generated by this script. For security reasons, unless you have a large number of email accounts at a single domain, it is more secure to list the full email address for each recipient.

Once you have modified these two fields, save the file.

Usage

Create an HTML form page.

For example, create a file called form.html, copy the following HTML code to the file, and place the file in the DocumentRoot directory for the intended subhost:

<form method="POST" action="/cgi-bin/FormMail.pl">
<input type="hidden" name="recipient"
value="order@YOUR-DOMAIN.NAME">
<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>
Replace the recipient email address (order@YOUR-DOMAIN.NAME) to the same email address previously added to the @allow_mail_to line in the FormMail.pl script.

To test the form you would use a url similar to the following:

http://YOUR-DOMAIN.NAME/form.html

When creating an HTML form page, the form should include at least the following field:

  • 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 README file in the /usr/local/FormMail directory for a complete presentation of the supported fields.

Documentation

For more help on creating an HTML form page, please see the following url:

HTML Forms and Input


Home | About Us | Web Hosting | Web Servers | eCommerce | Order

© 1996 - 2008 Web Hosting Solutions
1311 Darcann Drive, Columbus, OH 43220
1-888-522-3738
Money Back Guarantee
99.9% Uptime Guarantee

Like sports? Visit ColumbusSports.com