FormMail is a CGI program designed to generate e-mail based on the input from an HTML form.
Installation
To install the FormMail CGI on your Virtual Private Server, connect to your server via SSH, su to root, and do the following:
# vinstall formmail
This command installs three files, FormMail.pl, FormMail.examples and FormMail.readme, into your /www/cgi-bin directory. The examples and readme files contain various information and examples on using FormMail.
You will need to set up the script to use your account information. Open the file FormMail.pl and modify the following lines in 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 E-mail addresses and put either the domain, or a full E-mail address for every account that should be allowed to recieve Email messages from this form. For security reasons, unless you have a large number of Email accounts at a single domain, it is better to list the full address for each recipient.
Once you have modified these two fields, save the file.
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
The recipient in the form must match one of the E-mail addresses in your @allow_mail_to line in the script.
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>
Once your form is complete, you should be able to send E-mail messages using it.
Please note: the information on this page applies to ITS web hosting plans. It may or may not apply to other environments. If you are looking for a feature described here, or better support from your hosting provider, please consider hosting your site with ITS!
Copyright © 1996-2024, Integrated Technical Solutions, Inc., all rights reserved. See Terms/Legal for trademarks, copyright, and terms of use.
Naperville, IL 60563
fax 630.420.2771