internak server error

i have one problem.i use cgi to send email but the coding is in perl.when i send enewletter in bulk using the coding, there is error message occur as below stated:

"Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log. "


why is this happening, the email still can be send despite of this error.why is this error message appear?


this is the coding:

[coding]

use DBI; #the perl database module
use Net::SMTP;

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;
if ($INPUT{$name}) { $INPUT{$name} = $INPUT{$name}.",".$value; }
else { $INPUT{$name} = $value; }
}

$pid = fork();
print "Content-type: text/html

fork failed: $!" unless defined $pid;

if ($pid) {
my $subject;
my $sender_uid;

$subject = $INPUT{'subject'};
$sender_uid = $INPUT{'sender_uid'};
$sender_uname = $INPUT{'sender_uname'};
$ip = $INPUT['ip'];

# connect to mysql
my $dbh = DBI->connect('DBI:mysql:database=apple:hostname=localhost','appleql','apple');
my $RowAffected = $dbh->do("INSERT INTO apple_mailing_report SET title='$subject',uid='$sender_uid',date=NOW()") or die "Can't connect";
my $log = $dbh->do("INSERT INTO apple_en_activity SET date=now(),time=now(),ip='$ip',login='$sender_uname',activity='Newsletter'") or die "Can't connect";
$dbh->disconnect();

print "Content-type: text/html

";
print "
";
print "
";
print " Administration
";
print "
";
print "
";
print "
";
print "



";
print "
";
print "
";
print " ";
print " ";
print "

";
print "
";
print "
";
print "
";
print " ";
print " ";
print "
";
print " ";
print " ";
print "
Send Status

Success!
The message was sent.
";
print "

";
print "
";
print "
";
print "

";
print "
";
print "";

exit(0);
}
else {
close (STDOUT);

open(LIST,"$INPUT{'address_file'}");
@addresses=;
close(LIST);

foreach $line(@addresses) {
chomp($line);
my $ServerName = "relay.apple.com";

# Connect to the server
$smtp = Net::SMTP->new($ServerName);
die "Couldn't connect to server" unless $smtp;

my $MailFrom = $INPUT{'from'};
my $MailTo = $line;

$smtp->mail( $MailFrom );
$smtp->to( $MailTo );

# Start the mail
$smtp->data();

# Send the header.
$smtp->datasend("To: $line
");
$smtp->datasend("From: $INPUT{'from'}
");
$smtp->datasend("Subject: $INPUT{'subject'}
");
$smtp->datasend("MIME-Version: 1.0
");
$smtp->datasend("Content-Type: text/html
");
$smtp->datasend("Content-Transfer-Encoding: 7bit

");
$smtp->datasend("
");
$smtp->datasend("
");
$smtp->datasend("eHomemaker.net
");
$smtp->datasend("
");
$smtp->datasend("
");

# Send the message
$smtp->datasend("$INPUT{'body'}");
$smtp->datasend("
");
$smtp->datasend("");
$smtp->datasend("

");

# Send the termination string
$smtp->dataend();
$smtp->quit();
}
}

[/coding]


Comments

  • : i have one problem.i use cgi to send email but the coding is in perl.when i send enewletter in bulk using the coding, there is error message occur as below stated:
    :
    : "Internal Server Error
    : The server encountered an internal error or misconfiguration and was unable to complete your request.
    :
    : Please contact the server administrator, inform them of the time the error occurred, and anything you might have done that may have caused the error.
    :
    : More information about this error may be available in the server error log. "
    :
    :
    : why is this happening, the email still can be send despite of this error.why is this error message appear?
    :
    It'll be because you never print a valid HTTP header, or more likely something is printed before that. Try putting a:-

    print "Content-type: text/html

    ";

    Near the top of your script so you can find what is unexpectedly being printed before the headers and messing things up.

    Hope this helps,

    Jonathan


    ###
    for(74,117,115,116){$::a.=chr};(($_.='qwertyui')&&
    (tr/yuiqwert/her anot/))for($::b);for($::c){$_.=$^X;
    /(p.{2}l)/;$_=$1}$::b=~/(..)$/;print("$::a$::b $::c hack$1.");

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion