Limbic~Region has asked for the wisdom of the Perl Monks concerning the following question:

All,
In #perl tonight, a question was asked about a SMTP module that supported both SSL and authentication. A quick search of CPAN turned up Net::SMTP::SSL and Net::SMTP_auth, but nothing that combined the two.

I jokingly said if I had more than 14 minutes until Jeapordy started, I would whip something up. Then I looked under the hood. Net::SMTP::SSL basically just uses IO::Socket::SSL and does some symbol table manipulation. Net::SMTP_auth inherits from Net::SMTP and add a couple of new methods.

I offered that all one would have to do is change two lines in Net::SMTP_auth:

In your main script, you use Net::SMTP_auth which can now do everything you want. Unfortunately, the person asking didn't have a test script.

Anyone out there able to test and verify this for me? I would first attempt to contact the author to add this support and if that doesn't work upload something myself.

Cheers - L~R

Update: It works! naChoZ was kind enough to point out that anyone with a gmail account can try this themselves.

  • Comment on SMTP Module Supporting SSL and Authentication?

Replies are listed 'Best First'.
Re: SMTP Module Supporting SSL and Authentication?
by Limbic~Region (Chancellor) on Apr 15, 2005 at 23:50 UTC
    All,
    Incidently, after getting back from my gameshow fix, I discovered that Email::Send::SMTP apparently does this already. Here is an excerpt from the docs:

    Any arguments passed to send will be passed to Net::SMTP->new(), with some exceptions. username and password, if passed, are used to invoke Net::SMTP->auth() for SASL authentication support. ssl, if set to true, turns on SSL support by using Net::SMTP::SSL.

    ahhhhh - the power of perl.

    Cheers - L~R