Subject: | Problem with _secflags on second use |
I recently wrote a short script to send mail through an SMTP server that requires authentication. The first message I sent worked beautifully, but when I tried to send two messages from the same script, I got errors in Authen::SASL::Perl. Here's the debug output leading up to the actual bug:
Net::SMTP=GLOB(0x81b38e0)<<< 250-puffin.mail.pas.earthlink.net Hello node-423a0c29.lga.onnet.us.uu.net [66.58.12.41]
Net::SMTP=GLOB(0x81b38e0)<<< 250-SIZE 10485760
Net::SMTP=GLOB(0x81b38e0)<<< 250-PIPELINING
Net::SMTP=GLOB(0x81b38e0)<<< 250-AUTH PLAIN LOGIN CRAM-MD5
Net::SMTP=GLOB(0x81b38e0)<<< 250-STARTTLS
Net::SMTP=GLOB(0x81b38e0)<<< 250 HELP
Can't locate object method "_secflags" via package "Authen::SASL::Perl::CRAM_MD5" at /usr/lib/perl5/site_perl/5.8.0/Authen/SASL/Perl.pm line 32.
Again, this only happened if I sent mail twice from the same script. The script I used to demonstrate this problem is shown below, sans password:
#!/usr/bin/perl
use Net::SMTP;
use strict;
use warnings;
for(1..2)
{
my $smtp = Net::SMTP->new('smtpauth.earthlink.net',
Hello => 'milkbone.org', Debug => 1) or die
+"death";
$smtp->auth('batkins86@earthlink.net', '***************************');
$smtp->mail('monitor@milkbone.org');
$smtp->to('test@batkins.com');
$smtp->data();
$smtp->datasend("To: postmaster\n");
$smtp->datasend("\n");
$smtp->datasend("A simple test message\n");
$smtp->dataend();
$smtp->quit;
}
As you can see, it connects to my SMTP server and then sends a message and then does it all again. The first message goes through perfectly, but the second yields the ouput given above.
I managed to work around this by removing the call to _secflags in Authen/SASL/Perl.pm line 32. I can now successfully send two e-mails from one script, but I'm positive that this isn't the way things should be.
If you need any more information, feel free to send me an e-mail.
P.S. - I ran this script on a GNU/Linux box running Perl 5.6.1 with the latest version (2.04, I believe) of Authen::SASL.