Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Error message not showing up from Net::SMTP

by ikegami (Patriarch)
on Sep 05, 2007 at 15:58 UTC ( [id://637190]=note: print w/replies, xml ) Need Help??


in reply to Error message not showing up from Net::SMTP

What do you mean by "the failure is silent"? Your output clearly shows auth communicated the failure.

Do you mean the error isn't in $!? $!'s content are meaningless unless a system call returned an error. You didn't make any system calls, much less one that returned an error. Perhaps you want $mail->code and/or $mail->message? (Remember, Net::SMTP objects are descendant of Net::Cmd.)

Replies are listed 'Best First'.
Re^2: Error message not showing up from Net::SMTP
by sg (Pilgrim) on Sep 05, 2007 at 17:25 UTC
    The message in the output came from user code when auth() returned false. The Net::SMTP module has the set status line:
    $self->set_status(500, ["Need MIME::Base64 and Authen::SASL todo auth" +]), return 0;
    Why didn't the precise error message "Need MIME::Base64 and Authen::SASL todo auth" get to the end-user? Or what exactly should the user have done differently in the user-code to have gotten that precise, informative error message?
      Replace
      print "ERROR: Could not authenticate user $user_id\n$!\n";
      with
      print "ERROR: Could not authenticate user $user_id\n$: ".$mail->messa +ge."\n";
      or equivalent.
        Thanks for the details. Augmenting the print statement with
        $mail->code,':',$mail->message,"\n";
        does indeed display the desired error message.
      Perhaps you should read my entire post instead of focusing on the rhetorical question. It explains why the message isn't returned via $!, and where it can be found.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://637190]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (3)
As of 2025-06-17 03:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.