Complete installation and configuration guide for FormMail - the universal WWW form to email gateway (v1.6)
##############################################################################
# FormMail Version 1.6 #
# Copyright 1996-1997 Matt Wright [email protected] #
# Created 06/09/95 Last Modified 05/02/97 #
# Matt's Script Archive, Inc.: http://www.worldwidemart.com/scripts/ #
##############################################################################
# COPYRIGHT NOTICE #
# Copyright 1995 - 1997 Matthew M. Wright All Rights Reserved. #
# #
# FormMail may be used and modified free of charge by anyone so long as this #
# copyright notice and the comments above remain intact. By using this #
# code you agree to indemnify Matthew M. Wright from any liability that #
# might arise from its use. #
##############################################################################
FormMail is a universal WWW form to E-mail gateway. There is only one required form input tag which must be specified in order for this script to work with your existing forms. Other hidden configuration fields can also be used to enhance the operation of FormMail on your site.
Version 1.6 of FormMail contains:
FormMail.pl needs to be placed in your server's cgi-bin directory and the anonymous WWW user must have the ability to read/execute the script. Permission: chmod 755 FormMail.pl
The FormMail.pl script does not have to be extensively configured in order to work. There are only two variables in the perl file which you will need to define along with changing the top line of your script to match the location of your Perl interpreter.
| Variable | $mailprog = '/usr/lib/sendmail'; |
|---|---|
| Description | This variable must define the location to your server's sendmail program. If this is incorrect, form results will not be mailed to you. |
| Common Values |
/usr/lib/sendmail/usr/sbin/sendmail/usr/bin/sendmail
|
| Variable | @referers = ('worldwidemart.com','206.31.72.203'); |
|---|---|
| Description | This array allows you to define the domains that you will allow forms to reside on and use your FormMail script. If a user tries to put a form on another server not in this list, they will receive an error message. |
| Security Note | By placing worldwidemart.com in the @referers array, this also allows www.worldwidemart.com, ftp.worldwidemart.com, any other http address with worldwidemart.com in it and the IP address to access the script. |
The action of your form needs to point towards this script, and the method must be POST or GET in capital letters.
There is only one form field that you must have in your form for FormMail to work correctly:
recipientThis form field allows you to specify to whom you wish for your form results to be mailed.
<input type="hidden" name="recipient" value="[email protected]">
Specify the subject that will appear in the e-mail. Default: "WWW Form Submission"
<input type="hidden" name="subject" value="Your Subject">
<!-- Or allow user to choose: -->
<input type="text" name="subject">
Allow the user to specify their return e-mail address. This will be put into the From: field of the message you receive.
<input type="text" name="email">
Allow the user to input their real name. This will also be put into the From: line of your message header.
<input type="text" name="realname">
Redirect the user to a different URL rather than having them see the default response page.
<input type="hidden" name="redirect" value="http://your.host.com/thanks.html">
Specify which fields must be filled in before the form can be successfully submitted.
<input type="hidden" name="required" value="email,phone,name">
Include environment variables in the e-mail message:
REMOTE_HOST - Hostname making the requestREMOTE_ADDR - IP address of the remote hostHTTP_USER_AGENT - Browser the client is using<input type="hidden" name="env_report" value="REMOTE_HOST,HTTP_USER_AGENT">
Choose the order in which variables appear in the e-mail.
<!-- Alphabetical sorting: -->
<input type="hidden" name="sort" value="alphabetic">
<!-- Custom order: -->
<input type="hidden" name="sort" value="order:name,email,phone,message">
Specify which config variables to print in the e-mail body (email, subject, etc.).
<input type="hidden" name="print_config" value="email,subject">
Print all form fields in the return HTML, regardless of whether they were filled in.
<input type="hidden" name="print_blank_fields" value="1">
Specify the title and header that will appear on the resulting page (if no redirect URL).
<input type="hidden" name="title" value="Feedback Form Results">
Add a link back to your main page on the results page.
<input type="hidden" name="return_link_url" value="http://your.host.com/main.html">
<input type="hidden" name="return_link_title" value="Back to Main Page">
Specify a URL to redirect users to if required fields are not filled in.
<input type="hidden" name="missing_fields_redirect" value="http://your.host.com/error.html">
Customize the appearance of the response page:
background |
Background image URL |
bgcolor |
Background color (e.g., #FFFFFF) |
text_color |
Text color |
link_color |
Link color |
vlink_color |
Visited link color |
alink_color |
Active link color (v1.4+) |
| Version | Date | Changes |
|---|---|---|
| 1.0 | 06/11/95 | Initial release |
| 1.1 | 08/03/95 | Security hole fixed (command execution); redirect option added |
| 1.2 | 09/23/95 | Special fields no longer printed to mail or screen |
| 1.3 | 01/21/96 | Added: env_report, bgcolor, background, colors, title, return_link, required fields; @referers security |
| 1.4 | 01/23/96 | Added: sort, alink_color; bug fixes; GET/POST support |
| 1.5 | 02/05/96 | Sorting fixed; print_config option added |
| 1.6 | 05/02/97 | Default sorting by form order; better parsing; HTTPS redirect fix; email validation; print_blank_fields; missing_fields_redirect |
<form action="/cgi-bin/FormMail.pl" method="POST">
<!-- Required -->
<input type="hidden" name="recipient" value="[email protected]">
<!-- Optional Configuration -->
<input type="hidden" name="subject" value="Contact Form Submission">
<input type="hidden" name="redirect" value="http://example.com/thanks.html">
<input type="hidden" name="required" value="name,email,message">
<input type="hidden" name="env_report" value="REMOTE_HOST,HTTP_USER_AGENT">
<input type="hidden" name="sort" value="order:name,email,phone,message">
<!-- Form Fields -->
<p>
<label>Name:</label><br>
<input type="text" name="name" size="40">
</p>
<p>
<label>Email:</label><br>
<input type="text" name="email" size="40">
</p>
<p>
<label>Phone:</label><br>
<input type="text" name="phone" size="20">
</p>
<p>
<label>Message:</label><br>
<textarea name="message" rows="6" cols="40"></textarea>
</p>
<p>
<input type="submit" value="Send Message">
<input type="reset" value="Clear Form">
</p>
</form>
Installation guide for the Guestbook script
Installation guide for the WWWBoard forum
Browse all script documentation