Thanks to everybody who replied.
I used Bill's suggestion below and I managed to get it working, using the sample code in the HTML help file for Net::SMTP as a starting point, and ending up with code that looked roughly like what John Serink posted.
Thanks also to "Sir Twist" for explaining how to use Net::SMTP_auth and explaining the output I was seeing :)
-Bennett
At 07:51 PM 12/18/2004 -0800, $Bill Luebkert wrote: Bennett Haselton wrote:
> Does anybody have any sample code for sending mail from a Perl script on
> Windows, through an SMTP server that requires SMTP authentication?
>
> I have a script where I wrote the logic in fifteen minutes and then have
> spent about three hours trying to look up a way for Perl to simply send the
> email. I found the Mail::Mailer module but its documentation page says it
> specifically doesn't support SMTP authentication. I found the
> Net::SMTP_auth module searching PPM modules for "SMTP", but the sample code
> given in the documentation:
>
> $smtp->auth('CRAM-MD5', 'user', 'password');
>
> only shows how set the authentication method to "CRAM-MD5". It doesn't
> list any other valid values that are accepted for the authentication
> method. It does say that I can use this code:
>
> $smtp = Net::SMTP_auth->new('mail.speakeasy.net');
> print $smtp->auth_types();
>
> to find out what authentication types are supported by mail.speakeasy.net;
> when I do that, the only value returned is "LOGINPLAIN", and if I try this
> code:
>
> $smtp->auth('LOGINPLAIN', 'user', 'password');
>
> I get the error:
>
> No SASL mechanism found
> at C:/Perl/site/lib/Authen/SASL.pm line 62
>
> which I assume is the generic error meaning the Net::SMTP_auth module
> doesn't support that authentication type, since it's the same error I get
> if I try using a junk authentication type e.g.
>
> $smtp->auth('FOOBAR', 'user', 'password');
Try using just plain Net::SMTP module - there is an auth method, but not sure if it's dependent on Authen::SASL or not.
--
,-/- __ _ _ $Bill Luebkert Mailto:[EMAIL PROTECTED]
(_/ / ) // // DBE Collectibles Mailto:[EMAIL PROTECTED]
/ ) /--< o // // Castle of Medieval Myth & Magic http://www.todbe.com/
-/-' /___/_<_</_</_ http://dbecoll.tripod.com/ (My Perl/Lakers stuff)
_______________________________________________ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
