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


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

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?

Replies are listed 'Best First'.
Re^3: Error message not showing up from Net::SMTP
by menolly (Hermit) on Sep 05, 2007 at 17:53 UTC
    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.
Re^3: Error message not showing up from Net::SMTP
by ikegami (Patriarch) on Sep 05, 2007 at 18:02 UTC
    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.