2
votes

im trying to send email via perl trough yahoo smtp server , and my code run on linux with no error but when i run this code on windows server 2008 r2 perl sys :

Net::SMTP>>> Net::SMTP(3.07)

Net::SMTP>>> Net::Cmd(3.07)

Net::SMTP>>> Exporter(5.72)

Net::SMTP>>> IO::Socket::IP(0.37)

Net::SMTP>>> IO::Socket(1.38)

Net::SMTP>>> IO::Handle(1.35)

Net::SMTP=GLOB(0x2b41c30)<<< 220 smtp.mail.yahoo.com ESMTP ready

Net::SMTP=GLOB(0x2b41c30)>>> EHLO smtp.mail.yahoo.com

Net::SMTP=GLOB(0x2b41c30)<<< 250-smtp.mail.yahoo.com

Net::SMTP=GLOB(0x2b41c30)<<< 250-PIPELINING

Net::SMTP=GLOB(0x2b41c30)<<< 250-SIZE 41697280

Net::SMTP=GLOB(0x2b41c30)<<< 250-8 BITMIME

Net::SMTP=GLOB(0x2b41c30)<<< 250 STARTTLS

Net::SMTP=GLOB(0x2b41c30)>>> STARTTLS

Net::SMTP=GLOB(0x2b41c30)<<< 220 2.0.0 Start TLS

Net::SMTP=GLOB(0x2b41c30)>>> RCPT TO:

Net::SMTP: Net::Cmd::getline(): unexpected EOF on command channel: Bad file descriptor at test.pl line 16.

Net::SMTP: Net::Cmd::_is_closed(): unexpected EOF on command channel: Bad file descriptor at test.pl line 17.

my code is:

use Net::SMTP 3.03;

my $mailer = Net::SMTP->new(
    'smtp.mail.yahoo.com',
    Hello   =>      'smtp.mail.yahoo.com',
    Port    =>      587,
    Debug => 1,
);

$mailer->starttls();
$mailer->auth('test','123');
    #!$mailer->mail('[email protected]');
    $mailer->to('[email protected]');
    $mailer->data();
    $mailer->datasend('From: [email protected] \r\n');
    $mailer->datasend('To: [email protected] \r\n');
    $mailer->datasend('Subject: testing \r\n');
    $mailer->datasend('Content-type: text/html \r\n\n');
    $mailer->datasend('\n');
    $mailer->datasend('test test test\r\n');
    $mailer->dataend();
$mailer->quit;

what is the problem ?

result with "perl -MIO::Socket::SSL=debug4 test.pl"

Net::SMTP>>> Net::SMTP(3.07)

Net::SMTP>>> Net::Cmd(3.07)

Net::SMTP>>> Exporter(5.72)

Net::SMTP>>> IO::Socket::IP(0.37)

Net::SMTP>>> IO::Socket(1.38)

Net::SMTP>>> IO::Handle(1.35)

Net::SMTP=GLOB(0x2dade80)<<< 220 smtp.mail.yahoo.com ESMTP ready

Net::SMTP=GLOB(0x2dade80)>>> EHLO smtp.mail.yahoo.com

Net::SMTP=GLOB(0x2dade80)<<< 250-smtp.mail.yahoo.com

Net::SMTP=GLOB(0x2dade80)<<< 250-PIPELINING

Net::SMTP=GLOB(0x2dade80)<<< 250-SIZE 41697280

Net::SMTP=GLOB(0x2dade80)<<< 250-8 BITMIME

Net::SMTP=GLOB(0x2dade80)<<< 250 STARTTLS

Net::SMTP=GLOB(0x2dade80)>>> STARTTLS

Net::SMTP=GLOB(0x2dade80)<<< 220 2.0.0 Start TLS

DEBUG: .../IO/Socket/SSL.pm:568: global error: SSL Version SSLv2 not supported

Net::SMTP=GLOB(0x2dade80)>>> MAIL FROM:

Net::SMTP: Net::Cmd::getline(): unexpected EOF on command channel: Bad file descriptor at test.pl line 15.

Net::SMTP: Net::Cmd::_is_closed(): unexpected EOF on command channel: Bad file descriptor at test.pl line 16.

Net::SMTP: Net::Cmd::_is_closed(): unexpected EOF on command channel: Bad file descriptor at test.pl line 16.

Net::SMTP: Net::Cmd::_is_closed(): unexpected EOF on command channel: Bad file descriptor at test.pl line 17.

Net::SMTP: Net::Cmd::_is_closed(): unexpected EOF on command channel: Bad file descriptor at test.pl line 17.

Net::SMTP: Net::Cmd::_is_closed(): unexpected EOF on command channel: Bad file descriptor at test.pl line 18.

Net::SMTP: Net::Cmd::_is_closed(): unexpected EOF on command channel: Bad file descriptor at test.pl line 19.

Net::SMTP: Net::Cmd::_is_closed(): unexpected EOF on command channel: Bad file descriptor at test.pl line 20.

Net::SMTP: Net::Cmd::_is_closed(): unexpected EOF on command channel: Bad file descriptor at test.pl line 21.

Net::SMTP: Net::Cmd::_is_closed(): unexpected EOF on command channel: Bad file descriptor at test.pl line 22.

Net::SMTP: Net::Cmd::_is_closed(): unexpected EOF on command channel: Bad file dscriptor at test.pl line 23.

Net::SMTP: Net::Cmd::_is_closed(): unexpected EOF on command channel: Bad file descriptor at test.pl line 24.

Net::SMTP: Net::Cmd::_is_closed(): unexpected EOF on command channel: Bad file descriptor at test.pl line 25.

Net::SMTP: Net::Cmd::_is_closed(): unexpected EOF on command channel: Bad file d

1
The login is missing in the debug output. This will happen if Authen::SASL is not or not properly installed.Steffen Ullrich
That's all very strange. Usually there is another EHLO after the STARTTLS but not in your debug output. But it is there if I run your code myself with the same version of Net::SMTP. Also, your RCPT TO gets sent before the STARTTLS is done. Can you please run your code with perl -MIO::Socket::SSL=debug4 test.pl and the debug output to the question (not in a comment)Steffen Ullrich
And please add error checking. starttls will return false if the SSL handshake failed which is probably the case for you. Try to install Mozilla::CA to get up-to-date root certificates usable from Perl.Steffen Ullrich
ok i added result to my question.user3001228
"...SSL Version SSLv2 not supported" - I have the feeling that your version of IO::Socket::SSL is not the original one but probably one which received (wrong) patches to work around problems with the broken Net::SMTP::TLS. Please make sure that you have installed an unchanged and current version of IO::Socket::SSL.Steffen Ullrich

1 Answers

1
votes

"...SSL Version SSLv2 not supported" - I have the feeling that your version of IO::Socket::SSL is not the original one but probably one which received (wrong) patches to work around problems with the broken Net::SMTP::TLS. Please make sure that you have installed an unchanged and current version of IO::Socket::SSL. – Steffen Ullrich