Perl Script to Mail Submitted Web Form Data

This simple Perl script allows the contents of a submitted web form to be emailed to a given address. Although there are other more sophisticated scripts that offer similar functionality, the main benefit of this one is that all the required mail header parameters are embedded in the script, rather than being picked up from the form, and hence provides a securer environment.

There are six variables that need setting up in the script to match local requirements:

To use this Perl script you should first copy it in your CGI BIN directory, giving it execute privileges (on a *nix system, this will require a CHMOD to #755). You should then reference the script in the action attribute of your form tag. e.g.

action="http://www.a.co.uk/cgi-bin/mailform.cgi"

Download compressed software (1,471 bytes)