Skip Menu |

This queue is for tickets about the libnet CPAN distribution.

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

People
Owner: Nobody in particular
Requestors: alexchorny [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in: 1.19
Fixed in: (no value)



Subject: Net::SMTP ignores SMTP errors
I'm receiving no error messages with MIME::Lite. To investigate this, I've wrote test program for Net::SMTP. Attached is program and it's output. As you can see message is received only in 'datasend' method, but it first appeared in 'mail'. ------- Alexandr Ciornii, http://chorny.net
Subject: mailtest.out
Download mailtest.out
application/octet-stream 1.2k

Message body not shown because it is not plain text.

Subject: mailtest.pl
#!/usr/bin/perl -w use strict; use Net::SMTP; my $smtp = Net::SMTP->new('mail.moldtelecom.md',Debug => 1); if ($smtp->mail('test@test.net')) { warn "Message: ".$smtp->message; # exit; } if ($smtp->to('alexchorny@gmail.com')) { warn "Message: ".$smtp->message; } if ($smtp->data()) { warn "Message: ".$smtp->message; } if ($smtp->datasend("To: alexchorny\@gmail.com\n")) { warn "Message: ".$smtp->message; } $smtp->datasend("\n"); $smtp->datasend("A simple test message\n"); $smtp->dataend(); $smtp->quit;
Subject: Re: [rt.cpan.org #20980] Net::SMTP ignores SMTP errors
Date: Thu, 17 Aug 2006 19:52:40 -0500
To: bug-libnet [...] rt.cpan.org
From: Graham Barr <gbarr [...] pobox.com>
On Aug 14, 2006, at 5:51 AM, alexchorny@gmail.com via RT wrote: Show quoted text
> I'm receiving no error messages with MIME::Lite. To investigate this, > I've wrote test program for Net::SMTP. > Attached is program and it's output. As you can see message is > received > only in 'datasend' method, but it first appeared in 'mail'.
And you did not check for it. You code reads if ($smtp->mail('test@test.net')) { warn "Message: ".$smtp->message; # exit; } Your code is missing a ! (or change if to unless). Methods (including ->mail) return true on sucess and false when there was an error Although there is a bug. That datasend should have failed because the prior DATA command failed. Graham.
Subject: Net::SMTP documentation patch
From: Alexandr Ciornii <alexchorny [...] gmail.com>
On Aug 17 20:52:59 2006, gbarr@pobox.com wrote: Show quoted text
> Your code is missing a ! (or change if to unless). Methods (including > ->mail) return true on sucess and false when there was an error
Wrote patch for Net::SMTP. If has error check in example and makes several things more clear in documentation. Will submit this patch also to perl5 porters list. ------- Alexandr Ciornii, http://chorny.net
--- SMTP.pm.dist Wed Jun 30 16:56:11 2004 +++ SMTP.pm Mon Sep 18 14:03:19 2006 @@ -573,16 +573,18 @@ use Net::SMTP; - $smtp = Net::SMTP->new('mailhost'); + my $smtp = Net::SMTP->new('mailhost'); $smtp->mail($ENV{USER}); - $smtp->to('postmaster'); - - $smtp->data(); - $smtp->datasend("To: postmaster\n"); - $smtp->datasend("\n"); - $smtp->datasend("A simple test message\n"); - $smtp->dataend(); + if ($smtp->to('postmaster')) { + $smtp->data(); + $smtp->datasend("To: postmaster\n"); + $smtp->datasend("\n"); + $smtp->datasend("A simple test message\n"); + $smtp->dataend(); + } else { + print "Error: ", $smtp->message(); + } $smtp->quit; @@ -606,11 +608,14 @@ specifies a string to pass as your mail domain. If not given localhost.localdomain will be used. -B<Host> - SMTP host to connect to. It may be a single scalar, as defined for -the C<PeerAddr> option in L<IO::Socket::INET>, or a reference to +B<Host> - SMTP host to connect to. It may be a single scalar (hostname[:port]), +as defined for the C<PeerAddr> option in L<IO::Socket::INET>, or a reference to an array with hosts to try in turn. The L</host> method will return the value which was used to connect to the host. +B<Port> - port to connect to. Format - C<PeerHost> from L<IO::Socket::INET> new method. +Default - 25. + B<LocalAddr> and B<LocalPort> - These parameters are passed directly to IO::Socket to allow binding the socket to a local port. @@ -686,7 +691,7 @@ =item auth ( USERNAME, PASSWORD ) -Attempt SASL authentication. +Attempt SASL authentication. Requires Authen::SASL module. =item mail ( ADDRESS [, OPTIONS] ) @@ -810,6 +815,10 @@ Most sites usually disable this feature in their SMTP service configuration. Use "Debug => 1" option under new() to see if disabled. +=item message () + +Returns the text message returned from the last command. (Net::Cmd method) + =item help ( [ $subject ] ) Request help text from the server. Returns the text or undef upon failure
Subject: Re: [rt.cpan.org #20980] Net::SMTP documentation patch
Date: Wed, 20 Sep 2006 10:01:42 -0500 (CDT)
To: bug-libnet [...] rt.cpan.org
From: "Graham Barr" <gbarr [...] pobox.com>
On Mon, September 18, 2006 7:34 am, alexchorny@gmail.com via RT wrote: Show quoted text
> Wrote patch for Net::SMTP. If has error check in example and makes > several things more clear in documentation.
Thanks