jking_98 has asked for the wisdom of the Perl Monks concerning the following question:

I am trying to use Net::SMTP_auth to send emails because our mail provider requires authentication.

The code (see below) works on our Linux Server that is running Perl v5.6.0 but fails authentication on our server that is running Perl v5.8.0

Any ideas on why this same code will work on Perl 5.6.0 but not on Perl 5.8.0?

Thanks in advance.

Code:
my $email = MIME::Lite->new( From => $from_address, To => \@to_addresses, Cc => \@cc_addresses, Bcc => \@bcc_addresses, Subject => 'test', Type => 'multipart/alternative', ); $email->attach(Type => 'text/html',Data => "HTML Text"); $email->attach(Type => 'text/plain',Data => "Plan Text"); # get the message my $message_body = $email->as_string(); # Create a new SMTP object my $smtp = Net::SMTP_auth->new($host, Timeout => 60, Debug => 1) or die "Couldn't connect to server"; my $res = $smtp->auth('LOGIN',$user_name,$password); $smtp->mail($from_address); $smtp->to(@to_addresses); $smtp->cc(@cc_addresses); $smtp->bcc(@bcc_addresses); $smtp->data(); $smtp->datasend($message_body); $smtp->dataend(); # Close the connection $smtp->quit();

Replies are listed 'Best First'.
Re: Using Net::SMTP_auth to send authenticated emails
by tcf22 (Priest) on Aug 20, 2003 at 20:09 UTC
    Are you getting any sort of error message, or does the authentication just fail. My first thought was that it may be the module, but I haven't been able to find any reports of Net::SMTP_auth, not working on perl 5.8.

    Is it possible that each server has a different version of Net::SMTP_auth. I see that the new version(0.07) uses Authen::SASL to authenticate and a previous(0.05) doesn't. This is the only thing that I can think off of the top of my head. Your code looks fine to me.
      Thanks for your insight. It turned out to be a problem with the version of Net::CMD I was using. I upgraded to the latest version and it is working correctly on both servers now.

      Thanks again.