I have not programmed in perl in about 2 years, so I'm hoping someone here can look at this real quick and find that I have made a stupid mistake. I modified this from a script I made a while ago - that script worked. When I run this as debug (perl -c mailer.cgi) perl says the syntax is OK. For the first couple of debug runs I got some sort of message I didn't write down about unterminated string end_of_header (or something like that) - all I did was cut out a line that said end_of_header, then pasted it back in, and the next
perl -c mailer.cgi run said syntax ok. But when I try to run it on the sever I get an internal server error
"The server encountered an internal error or misconfiguration and was unable to complete your request." The server logs say error 500, 606, and premature end of header. Here is the script:
#!/usr/bin/perl5 -w
use strict;
use CGI qwall);
use CGI::Carp qw(fatalsToBrowser);
# use Fcntl qwflock);
sub send_mail {
my($to, $from, $subject, @details)=@_;
my $sendmail="/usr/sbin/sendmail -t -oi";
open(MAIL, "|$sendmail") || die "Can't start sendmail: $!";
print MAIL<<END_OF_HEADER;
from: $from
to: $to
subject: $subject
END_OF_HEADER
print MAIL "Tournament entry request\n\n";
my $name = param("name");
print MAIL "$name\n";
my $address = param("address");
print MAIL "$address\n";
my $city = param("city");
print MAIL "$city,";
my $state = param("state");
print MAIL "$state ";
my $zip = param("zip");
print MAIL "$zip\n";
my $phone = param("phone");
print MAIL "$phone\n";
my $email=param("return_addr");
print MAIL "$email\n\n";
print MAIL "Member?\n";
my $member = param("member");
print MAIL "$member\n\n";
print MAIL "Please enter me into the following tournament(s)\n";
my $event = param("event");
print MAIL "$event\n\n";
print MAIL "Additional comments\n\n";
foreach (@details) {
print MAIL "$_\n";
}
print MAIL "\n";
close(MAIL);
}
print header;
my $return=param("return_addr");
if (! defined $return or ! $return) {
print "You must supply an email address<P>";
exit;
}
my $subject=param("subject");
if (! defined $subject or ! $subject) {
print "You must supply an subject<P>";
exit;
}
send_mail('softech@sover.net',
$return,
$subject,
param("body"));
print "Mail sent.";
Thanks
Steve
perl -c mailer.cgi run said syntax ok. But when I try to run it on the sever I get an internal server error
"The server encountered an internal error or misconfiguration and was unable to complete your request." The server logs say error 500, 606, and premature end of header. Here is the script:
#!/usr/bin/perl5 -w
use strict;
use CGI qwall);
use CGI::Carp qw(fatalsToBrowser);
# use Fcntl qwflock);
sub send_mail {
my($to, $from, $subject, @details)=@_;
my $sendmail="/usr/sbin/sendmail -t -oi";
open(MAIL, "|$sendmail") || die "Can't start sendmail: $!";
print MAIL<<END_OF_HEADER;
from: $from
to: $to
subject: $subject
END_OF_HEADER
print MAIL "Tournament entry request\n\n";
my $name = param("name");
print MAIL "$name\n";
my $address = param("address");
print MAIL "$address\n";
my $city = param("city");
print MAIL "$city,";
my $state = param("state");
print MAIL "$state ";
my $zip = param("zip");
print MAIL "$zip\n";
my $phone = param("phone");
print MAIL "$phone\n";
my $email=param("return_addr");
print MAIL "$email\n\n";
print MAIL "Member?\n";
my $member = param("member");
print MAIL "$member\n\n";
print MAIL "Please enter me into the following tournament(s)\n";
my $event = param("event");
print MAIL "$event\n\n";
print MAIL "Additional comments\n\n";
foreach (@details) {
print MAIL "$_\n";
}
print MAIL "\n";
close(MAIL);
}
print header;
my $return=param("return_addr");
if (! defined $return or ! $return) {
print "You must supply an email address<P>";
exit;
}
my $subject=param("subject");
if (! defined $subject or ! $subject) {
print "You must supply an subject<P>";
exit;
}
send_mail('softech@sover.net',
$return,
$subject,
param("body"));
print "Mail sent.";
Thanks
Steve