L
LaMoRt
Hi there!
I have some problem in sending mail out from the server using the
script below
and it come error 500 internal error, pls contact server
administrator
Is there any problem with the code or ...?
Pls advise as i'm new in the cgi script :
#!/usr/bin/perl
use CGI::Carp qw(fatalsToBrowser);
if ($ENV{'REQUEST_METHOD'} eq 'POST') {
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split(/&/, $buffer);
foreach $pair (@pairs) {
($name, $value) = split(/=/, $pair);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$FORM{$name} = $value;
}
open (MESSAGE,"| /usr/sbin/sendmail -t");
print MESSAGE "To: test\test.com\n";
print MESSAGE "From: " . $FORM{name} . ", reader\n";
print MESSAGE "Reply-to: " . $FORM{email} . "(" . $FORM{name} . ")
\n";
print MESSAGE "Subject: Feedback from $FORM{name} \n\n";
print MESSAGE "$FORM{name} wrote:\n\n";
print MESSAGE "Comment: $FORM{comment}\n\n";
print MESSAGE "Sent by: $FORM{name} ($FORM{email}).\n";
close (MESSAGE);
&thank_you; #method call
}
sub thank_you {
print "Content-type: text/html\n\n";
print <<EndStart;
<html>
<head>
<title>Thank You</title>
</head>
<body bgcolor="#ffffff" text="#000000">
<h1>Thank You</h1>
<p>Your feedback has been received. Thanks for sending it.</p>
<hr>
EndStart
print "<p>You wrote:</p>\n";
print "<blockquote><em>$FORM{comment}</em></blockquote>\n\n";
print <<EndHTML;
</body>
</html>
EndHTML
exit(0);
}
I have some problem in sending mail out from the server using the
script below
and it come error 500 internal error, pls contact server
administrator
Is there any problem with the code or ...?
Pls advise as i'm new in the cgi script :
#!/usr/bin/perl
use CGI::Carp qw(fatalsToBrowser);
if ($ENV{'REQUEST_METHOD'} eq 'POST') {
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split(/&/, $buffer);
foreach $pair (@pairs) {
($name, $value) = split(/=/, $pair);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$FORM{$name} = $value;
}
open (MESSAGE,"| /usr/sbin/sendmail -t");
print MESSAGE "To: test\test.com\n";
print MESSAGE "From: " . $FORM{name} . ", reader\n";
print MESSAGE "Reply-to: " . $FORM{email} . "(" . $FORM{name} . ")
\n";
print MESSAGE "Subject: Feedback from $FORM{name} \n\n";
print MESSAGE "$FORM{name} wrote:\n\n";
print MESSAGE "Comment: $FORM{comment}\n\n";
print MESSAGE "Sent by: $FORM{name} ($FORM{email}).\n";
close (MESSAGE);
&thank_you; #method call
}
sub thank_you {
print "Content-type: text/html\n\n";
print <<EndStart;
<html>
<head>
<title>Thank You</title>
</head>
<body bgcolor="#ffffff" text="#000000">
<h1>Thank You</h1>
<p>Your feedback has been received. Thanks for sending it.</p>
<hr>
EndStart
print "<p>You wrote:</p>\n";
print "<blockquote><em>$FORM{comment}</em></blockquote>\n\n";
print <<EndHTML;
</body>
</html>
EndHTML
exit(0);
}