develooper Front page | perl.beginners | Postings from June 2001

CGI.pm and sendmail not working together

From:
David Unthank
Date:
June 1, 2001 12:52
Subject:
CGI.pm and sendmail not working together
Message ID:
5.1.0.14.0.20010601153454.00a29dc0@192.168.0.2
Hello All,

This script does 2 things - parses form data from a form, then emails it out.

Well it parses the data, but doesn't email it; or

With different, non-CGI.pm parsing code (from formmail.cgi) it does email 
out through sendmail.

Anybody have any ideas why it doesn't work like this???

Running RedHat 6.2 with sendmail 8.11.1 and CGI.pm 2.753

======
Script
======
#!/usr/bin/perl

use CGI;
&parse_input;
print "Content-type: text/html\n\n";
&mail;

sub mail {      open (MAIL, "|sendmail -t") || die "Cannot open mail $!";
         print MAIL "To: admin\@integrahosting.com\n";
         print MAIL "From: $F{'email'}\n";
         #print MAIL "CC: $F{'email'}\n";
         print MAIL "Subject: Custom Request Form\n\n";
         print MAIL "$F{'description'}\n\n";
         print MAIL "Name: $F{'name'}\n";
         print MAIL "Email: $F{'email'}\n";
         print MAIL "Phone Number: $F{'phone'}\n";
         close (MAIL);print "Thank you, Your request has been sent.  We 
will answer your request in the order it was received and reply promptly.";
}exit;
#sub mail_them{
#       open (MAIL, "|sendmail -t") || die "Cannot open mail $!";
#       print MAIL "To: $F{'email'} \nFrom: admin\@integrahosting.com\n";
#
#       print MAIL "Subject: Custom Request Received\n\n";
#
#       print MAIL "Hello $F{'name'}!\n\n";
#       print MAIL "Thank you for your interest in our products, we look 
forward to contributing to your online success.\n\n";
#       close (MAIL);
#}

sub parse_input {
         $input = new CGI;
         @variables = $input->param();
         foreach(@variables){
                 $F{$_} = $input->param($_);
         }
}
=======
End of script
=======


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About