CGI Scripts help
griffij76 Jun 19, 2006 3:08 AMI have created a feedback form for a website, with in
dreamweaver 8, that was the easy bit but the part I seem to be
having great bother with is the CGI script to send the information
to where it is supposed to go. In a format that is easy to read.
Issue one thought I could just put in a mailto: action and then an e-mail address. That works but not very clear as the e-mail is hard to read. Scrap that idea.
On to idea 2 use a CGI script seemed pretty straight forward. You take from the web and change a few things and post it to your website and hey presto it works Not at all.
Please find below my script
#!/usr/bin/perl -wT
#
# $Id: FormMail.pl,v 2.22 2003/02/21 13:55:24 nickjc Exp $
#
use strict;
use POSIX qw(locale_h strftime);
use Text::Wrap; # Er for wrapping :)
use Socket; # for the inet_aton()
use CGI qw(:standard);
use vars qw(
$DEBUGGING $emulate_matts_code $secure
$allow_empty_ref $max_recipients $mailprog @referers
@allow_mail_to @recipients %recipient_alias
@valid_ENV $date_fmt $style $send_confirmation_mail
$confirmation_text $locale $charset $no_content
$double_spacing $wrap_text $wrap_style $postmaster
);
# PROGRAM INFORMATION
# -------------------
# FormMail.pl $Revision: 2.22 $
#
# This program is licensed in the same way as Perl
# itself. You are free to choose between the GNU Public
# License < http://www.gnu.org/licenses/gpl.html> or
# the Artistic License
# < http://www.perl.com/pub/a/language/misc/Artistic.html>
#
# For help on configuration or installation see the
# README file or the POD documentation at the end of
# this file.
# USER CONFIGURATION SECTION
# --------------------------
# Modify these to your own settings. You might have to
# contact your system administrator if you do not run
# your own web server. If the purpose of these
# parameters seems unclear, please see the README file.
#
BEGIN
{
$DEBUGGING = 1;
$emulate_matts_code= 0;
$secure = 1;
$allow_empty_ref = 1;
$max_recipients = 5;
$mailprog = '/usr/lib/sendmail -oi -t';
$postmaster = '';
@referers = qw(powerclean.org);
@allow_mail_to = qw();
@recipients = ();
%recipient_alias = ();
@valid_ENV = qw(REMOTE_HOST REMOTE_ADDR REMOTE_USER HTTP_USER_AGENT);
$locale = '';
$charset = 'iso-8859-1';
$date_fmt = '%A, %B %d, %Y at %H:%M:%S';
$style = '/css/nms.css';
$no_content = 0;
$double_spacing = 1;
$wrap_text = 0;
$wrap_style = 1;
$send_confirmation_mail = 0;
$confirmation_text = <<'END_OF_CONFIRMATION';
From: you@your.com
Subject: form submission
Thank you for your form submission.
Issue one thought I could just put in a mailto: action and then an e-mail address. That works but not very clear as the e-mail is hard to read. Scrap that idea.
On to idea 2 use a CGI script seemed pretty straight forward. You take from the web and change a few things and post it to your website and hey presto it works Not at all.
Please find below my script
#!/usr/bin/perl -wT
#
# $Id: FormMail.pl,v 2.22 2003/02/21 13:55:24 nickjc Exp $
#
use strict;
use POSIX qw(locale_h strftime);
use Text::Wrap; # Er for wrapping :)
use Socket; # for the inet_aton()
use CGI qw(:standard);
use vars qw(
$DEBUGGING $emulate_matts_code $secure
$allow_empty_ref $max_recipients $mailprog @referers
@allow_mail_to @recipients %recipient_alias
@valid_ENV $date_fmt $style $send_confirmation_mail
$confirmation_text $locale $charset $no_content
$double_spacing $wrap_text $wrap_style $postmaster
);
# PROGRAM INFORMATION
# -------------------
# FormMail.pl $Revision: 2.22 $
#
# This program is licensed in the same way as Perl
# itself. You are free to choose between the GNU Public
# License < http://www.gnu.org/licenses/gpl.html> or
# the Artistic License
# < http://www.perl.com/pub/a/language/misc/Artistic.html>
#
# For help on configuration or installation see the
# README file or the POD documentation at the end of
# this file.
# USER CONFIGURATION SECTION
# --------------------------
# Modify these to your own settings. You might have to
# contact your system administrator if you do not run
# your own web server. If the purpose of these
# parameters seems unclear, please see the README file.
#
BEGIN
{
$DEBUGGING = 1;
$emulate_matts_code= 0;
$secure = 1;
$allow_empty_ref = 1;
$max_recipients = 5;
$mailprog = '/usr/lib/sendmail -oi -t';
$postmaster = '';
@referers = qw(powerclean.org);
@allow_mail_to = qw();
@recipients = ();
%recipient_alias = ();
@valid_ENV = qw(REMOTE_HOST REMOTE_ADDR REMOTE_USER HTTP_USER_AGENT);
$locale = '';
$charset = 'iso-8859-1';
$date_fmt = '%A, %B %d, %Y at %H:%M:%S';
$style = '/css/nms.css';
$no_content = 0;
$double_spacing = 1;
$wrap_text = 0;
$wrap_style = 1;
$send_confirmation_mail = 0;
$confirmation_text = <<'END_OF_CONFIRMATION';
From: you@your.com
Subject: form submission
Thank you for your form submission.
