To install this full-featured version of formmail, you will need to install the formmail-z.pl script in your cgi-bin directory, then make the script executable. There is really no need to hack this script as most variables can be set from your html form page at runtime.
##############################################################################
# Define Variables
# Detailed Information Found In README File.
Below, enter the location of sendmail on your
server. If you have not changed the configuration
or directory structure, the line below will be
$mailprog = '/bin/sendmail';
# $mailprog defines the location of your sendmail program on your unix
# system.
$mailprog = '/usr/lib/sendmail';
Below, enter all possible domain names for your
virtual server, which would be your IP address,
www.your-domain.com, and your-domain.com. (in
place of worldwidemart.com)
# @referers allows forms to be located only on servers which are defined
# in this field. This fixes a security hole in the last version which
# allowed anyone on any server to use your FormMail script.
@referers = ('www.worldwidemart.com','worldwidemart.com','206.31.72.203');
# Done
#############################################################################
% chmod 755 ~/www/cgi-bin/formmail-z.pl
Example HTML source for an online form:
<form method="POST" action="/cgi-bin/formmail-z.pl"> <input type="hidden" name="recipient" value="get-info@yourdomain.com"> <input type="hidden" name="subject" value="Send Me Info"> Please Enter Your Name:<br> <input name="realname" size="40"> <p> Enter Your Email Address:<br> <input name="username" size="40"> <p> Enter your location:<br> <input name="hometown" size="40"> <p> . . . <input type="submit" value="Submit"> <input type="reset" value="Reset"> </form>
# open a message to the remote client
open (MAIL, "|$mailprog $FORM{'username'}") || die "Can't open $mailprog!\n";
print MAIL "To: $FORM{'username'} ($FORM{'realname'})\n";
print MAIL "Reply-To: $FORM{'recipient'}\n";
print MAIL "From: $FORM{'recipient'}\n";
print MAIL "Subject: $FORM{'subject'}\n\n";
# write out a customized response to the mail message
print MAIL "We have received your message and are delighted";
print MAIL "you have requested information about our products.";
print MAIL "Here is the information you requested - ";
print MAIL "Product 1. - info about product 1";
print MAIL "Product 2. - info about product 2";
print MAIL "Product 3. - info about product 3";
print MAIL "Product 4. - info about product 4";
print MAIL "Product 5. - info about product 5";
print MAIL "Yours truly, John Doe, sales rep.";
# close the message
close (MAIL);
Please Note: If you do use an autoresponder addition to the script, then the resulting script will be useable only by the form page owner who wants to reply with this particular autoreply.
One possible solution to this problem is to use one formmail-z.pl script without autoreply for everyone on your server to submit their forms to, and other versions of the script preconfigured with certain autoreplies. The secret is to name each different copy of the script differently (formmail-z.pl, formmail-z1.pl, formmail-z2.pl, etc.) and upload each to your cgi-bin and then make them executable with chmod.
FormMail's Author
FormMail was written by and continues to be developed by Matt Wright. For more information or for an excellent source of Perl scripts, see Matt's Script Archive.
HOME | SITE HOSTING | VIRTUAL SERVERS | PAGE DESIGN | FAQ | ORDER | TECH SUPPORT
Copyright © 1996, Sphynx Web Solutions. All rights reserved. All brand names and product names used on these web pages are trademarks, or trade names of their respective holders. Direct questions or comments to webmaster@sphynx.com.