Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
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>

In reply to Error message not showing up from Net::SMTP by sg

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (5)
As of 2024-06-20 05:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.