Skip Menu |

This queue is for tickets about the libnet CPAN distribution.

Report information
The Basics
Id: 42580
Status: resolved
Priority: 0/
Queue: libnet

People
Owner: Nobody in particular
Requestors: chip [...] 2bithacker.net
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 1.22
Fixed in: (no value)



Subject: Can't get end of DATA response in Net::SMTP
Having an issue with Net::SMTP when trying to get the message from the end-of-DATA response. Here's my code snippet: my $back = Net::SMTP->new(BACKHOST, Debug => 1); $back->mail( $session->get_sender() ); $back->to( $recipient ); my $success = $back->data(join "\n", @extra_headers, $$data); my ($code, $message) = ($back->code(), $back->message()); $back->quit; print "$code $message\n"; and here's the Debug output: Net::SMTP>>> Net::SMTP(2.31) Net::SMTP>>> Net::Cmd(2.29) Net::SMTP>>> Exporter(5.58) Net::SMTP>>> IO::Socket::INET(1.29) Net::SMTP>>> IO::Socket(1.29) Net::SMTP>>> IO::Handle(1.25) Net::SMTP=GLOB(0x80565d1e0)<<< 220 smtp-sink ESMTP Net::SMTP=GLOB(0x80565d1e0)>>> EHLO localhost.localdomain Net::SMTP=GLOB(0x80565d1e0)<<< 250-smtp-sink Net::SMTP=GLOB(0x80565d1e0)<<< 250-8BITMIME Net::SMTP=GLOB(0x80565d1e0)<<< 250-AUTH PLAIN LOGIN Net::SMTP=GLOB(0x80565d1e0)<<< 250-XCLIENT NAME HELO Net::SMTP=GLOB(0x80565d1e0)<<< 250-XFORWARD NAME ADDR PROTO HELO Net::SMTP=GLOB(0x80565d1e0)<<< 250-ENHANCEDSTATUSCODES Net::SMTP=GLOB(0x80565d1e0)<<< 250 Net::SMTP=GLOB(0x80565d1e0)>>> MAIL FROM:<doesntmatter@whatever> Net::SMTP=GLOB(0x80565d1e0)<<< 250 2.1.0 Ok Net::SMTP=GLOB(0x80565d1e0)>>> RCPT TO:<thisalso@doesntmatter> Net::SMTP=GLOB(0x80565d1e0)<<< 250 2.1.5 Ok Net::SMTP=GLOB(0x80565d1e0)>>> DATA Net::SMTP=GLOB(0x80565d1e0)<<< 354 End data with <CR><LF>.<CR><LF> Net::SMTP=GLOB(0x80565d1e0)>>> Date: Tue, 20 Jan 2009 16:55:50 +0000 Net::SMTP=GLOB(0x80565d1e0)>>> To: doesntmatter@whatever Net::SMTP=GLOB(0x80565d1e0)>>> From: thisalso@doesntmatter Net::SMTP=GLOB(0x80565d1e0)>>> Subject: test Tue, 20 Jan 2009 16:55:50 +0000 Net::SMTP=GLOB(0x80565d1e0)>>> X-Mailer: swaks v20061116.0 jetmore.org/john/code/#swaks Net::SMTP=GLOB(0x80565d1e0)>>> Net::SMTP=GLOB(0x80565d1e0)>>> This is a test mailing Net::SMTP=GLOB(0x80565d1e0)>>> Net::SMTP=GLOB(0x80565d1e0)>>> . Net::SMTP=GLOB(0x80565d1e0)<<< 500 5.3.0 Error: command failed Net::SMTP=GLOB(0x80565d1e0)>>> QUIT Net::SMTP=GLOB(0x80565d1e0)<<< 221 Bye My code will print out "500 End data with <CR><LF>.<CR><LF>" The expected result would be "500 5.3.0 Error: command failed" I find it odd that code() is correct, but message() has an older value. I've also tried using data(), datasend(), dataend() with the same results.
I figured it out, due to array context, message was returning the status from the start of DATA and the end of DATA, but only the first was getting into my scalar.