I
imahacker
The following code has crashed every machine i have tried it on except
for the original one i wrote it on. (3 out of 4 boxes) All are freshly
formatted with activestate installed. The program is perl/tk if that
makes a diff. i have also bundled it with perl2exe, and it crashes in
the same way. The program just "stops responding."
I have isolated the problem to the @line=<$ocket> line. If i comment
this line out, the script works as expected, but this is undesirable.
I would like to have the mail transfer information stored in a var.
putting the @line=<$ocket> AFTER the close($ocket) also fixes the
problem, but perl warns me that I am trying to read a socket has
already been closed, and doesnt store the information. Any help or
pointers in the right direction would be greatly appreciated, as i am
fairly new to perl.
$hostmail="mail.domain.net";
chomp($hostmail);
@message='
This is my email message.
';
$ocket = IO::Socket::INET->new(
PeerAddr => "$hostmail",
PeerPort => "25") || die "could not connect to $host: $!\n";
print $ocket "delo domain.net\n";
print $ocket "MAIL FROM: me\@domain.net\n";
print $ocket "RCPT TO: addy\@domain.net\n";
print $ocket "DATA\n";
print $ocket 'From: "nickname" <[email protected]>';
print $ocket "\n";
print $ocket "To: <addy\@domain.net>\n";
print $ocket "Subject: subject here\n\n";
print $ocket "@message";
print $ocket "\n.\nQUIT\n";
close($ocket);
@line=<$ocket>;
print "@line";
for the original one i wrote it on. (3 out of 4 boxes) All are freshly
formatted with activestate installed. The program is perl/tk if that
makes a diff. i have also bundled it with perl2exe, and it crashes in
the same way. The program just "stops responding."
I have isolated the problem to the @line=<$ocket> line. If i comment
this line out, the script works as expected, but this is undesirable.
I would like to have the mail transfer information stored in a var.
putting the @line=<$ocket> AFTER the close($ocket) also fixes the
problem, but perl warns me that I am trying to read a socket has
already been closed, and doesnt store the information. Any help or
pointers in the right direction would be greatly appreciated, as i am
fairly new to perl.
$hostmail="mail.domain.net";
chomp($hostmail);
@message='
This is my email message.
';
$ocket = IO::Socket::INET->new(
PeerAddr => "$hostmail",
PeerPort => "25") || die "could not connect to $host: $!\n";
print $ocket "delo domain.net\n";
print $ocket "MAIL FROM: me\@domain.net\n";
print $ocket "RCPT TO: addy\@domain.net\n";
print $ocket "DATA\n";
print $ocket 'From: "nickname" <[email protected]>';
print $ocket "\n";
print $ocket "To: <addy\@domain.net>\n";
print $ocket "Subject: subject here\n\n";
print $ocket "@message";
print $ocket "\n.\nQUIT\n";
close($ocket);
@line=<$ocket>;
print "@line";