Quote:
| Originally Posted by keath A print command is not required. You'd need to show more of your script for us to understand where the error is coming from. |
Her is the code I'm using:
#!/usr/bin/perl -w
use CGI;
my(%frmFlds);
$buffer = "";
getFormData(\%frmFlds);
#################################
#
# Change these variables as needed.
#
#################################
$sendmail = "/usr/sbin/sendmail";
$from = "learneasymoney\@gmail.com";
$subject = "Thank you for your interest in $frmFlds{'product'}";
open(MAIL, "|$sendmail -t") || die "Cannot open mail sender.\n";
print MAIL "To: $frmFlds{'email'} \n";
print MAIL "From: $from\n";
print MAIL "Subject: $subject\n";
print MAIL "Content-Type: text/html; charset=ISO-8859-1\n\n $frmFlds{'content'}\n";
close(MAIL);
sub getFormData {
my($hashRef) = shift;
$buffer = "";
if ($ENV{'REQUEST_METHOD'} eq 'GET') {
$buffer = $ENV{'QUERY_STRING'};
}
else {
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
}
foreach (split(/&/, $buffer)) {
my($key, $value) = split(/=/, $_);
$key = decodeURL($key);
$value = decodeURL($value);
%{$hashRef}->{$key} = $value;
}
}
sub decodeURL {
$_ = shift;
tr/+/ /;
s/%(..)/pack('c', hex($1))/eg;
return($_);
}