http://www.perlmonks.org?node_id=637170

sg has asked for the wisdom of the Perl Monks concerning the following question:

Hello,

Net::SMTP's sub auth() begins as:

sub auth { my (\$self, \$username, \$password) = \@_; eval { require MIME::Base64; require Authen::SASL; } or \$self->set_status(500, ["Need MIME::Base64 and Authen::SASL +todo auth"]), return 0;
In line 117, change Authen::SASL to Authen::SASLX, a non-existant module. One would think that the error message of line 118 would be given to the user. However, the failure is silent! Why?

Code to test is attached below -- need to provide a valid $smtp_host. Output from test is attached also.

Thanks

#!/use/bin/perl BEGIN {(*STDERR = *STDOUT) || die;} use diagnostics; use warnings; use strict; $| = 1; use Net::POP3; use Net::SMTP; my $smtp_host = 'smtp.host.com'; my $src_domain = 'the.org'; my $user_id = 'the_user_id'; my $password = 'the_password'; my %smtp_options = ( Host => $smtp_host, Hello => $src_domain, Debug => 4, ); if(!($mail = Net::SMTP->new(%smtp_options))) { print "ERROR: Could not open $smtp_host\n$!\n"; return -1; } if(!$mail->auth($user_id, $password)) { print "ERROR: Could not authenticate user $user_id\n$!\n"; $mail->quit(); return -1; } __END__ Net::SMTP>>> Net::SMTP(2.31) Net::SMTP>>> Net::Cmd(2.29) Net::SMTP>>> Exporter(5.60) Net::SMTP>>> IO::Socket::INET(1.31) Net::SMTP>>> IO::Socket(1.30) Net::SMTP>>> IO::Handle(1.27) Net::SMTP=GLOB(0x1b0b964)<<< 220 <smtp.host.com> ESMTP Net::SMTP=GLOB(0x1b0b964)>>> EHLO <the.org> Net::SMTP=GLOB(0x1b0b964)<<< 250-<smtp.host.com> Net::SMTP=GLOB(0x1b0b964)<<< 250-AUTH LOGIN PLAIN XYMCOOKIE Net::SMTP=GLOB(0x1b0b964)<<< 250-PIPELINING Net::SMTP=GLOB(0x1b0b964)<<< 250 8BITMIME ERROR: Could not authenticate user <user> No such file or directory Net::SMTP=GLOB(0x1b0b964)>>> QUIT Net::SMTP=GLOB(0x1b0b964)<<< 221 <smtp.host.com>