or would this be much better?

#!/usr/bin/perl -T

use strict;
use warnings;

use CGI();
use Mail::Mailer;

my $q = CGI->new();

# Email address where form submits are sent.
my $email = '[EMAIL PROTECTED]';

# Your subject for the form submits.
my $subject = '[INFO] Site Comment';

print $q->header();

foreach my $field(qw(name email city state message)) {
 if($q->param($field) =~ /^\s*$/) {
  print "Please fill in your $field.\n";
  exit;
 }
}

my $m = Mail::Mailer->new('sendmail');
 $m->open({From => $q->param('email'), To => $email, Subject => $subject,})
or die;
  print $m "Name: " . ucfirst($q->param('name')) . "\n";
  print $m "Location: " . ucfirst($q->param('city')) . ", " .
$q->param('state') . "\n\n";
  print $m $q->param('message');
 $m->close();

print "Thank you for contacting us.";



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to