Sending authenticated mail with Net::SMTP

As I’ve said earlier, one thing about open source is that you can fix fairly easily. In Perl this is especially easy, since it is turtles all the way down – many of the libraries are written in pure Perl, meaning that you can step through them with the Perl debugger.

This helped me recently for example, when I was trying to use Net::SMTP with a server which required authentication, and it kept failing on me. Finally I used the debugger to step into the library, and saw the following code:

eval {
  require MIME::Base64;
  require Authen::SASL;
} or $self->set_status(500, ["Need MIME::Base64 and Authen::SASL todo auth"]), return 0;

So, I installed the Authen::SASL module and everything worked. While I would have preferred for the module to say it more explicitly (dying with a suggestive error or in the documentation), but still, the fact that I could look at the source and understand the problem is great.

, ,

Leave a Reply

Your email address will not be published. Required fields are marked *