Reputation: 6041
I'm trying to send emails out using MIME::Lite
with authentication.
Here's the code snippet I am trying:
#!/usr/bin/perl
use strict;
use DBI;
use lib '/theannealing.com/perl/';
use MIME::Lite;
use MIME::Base64;
use Authen::SASL;
my $recipient = '[email protected]';
my $mailman = '[email protected]';
my $cc_recipient = '[email protected]';
my $subject = 'Subject';
my $email_message = "Message";
my ($user,$pass) = ("username","password");
MIME::Lite->send('smtp','smtp.server:port',AuthUser=>$user, AuthPass=>$pass);
my $email = new MIME::Lite(From => $mailman,To => $recipient,Cc => $cc_recipient,Subject => $subject,Data => "Data",Type => "multipart/mixed");
$email->attach(Type => 'TEXT', Data => "$email_message");
$email->send();
When I execute the script, I get this error message:
Cannot find a SASL Connection library at /usr/lib/perl5/5.8.8/Net/SMTP.pm line 143
I tried searching the error message and couldn't find any worth-while explanations and/or solutions to the problem with relevance to usage with MIME::Lite
Does anyone know what's wrong or what's producing that error message?
mail()
function works fine from a web browser, but does not work from the command line
Upvotes: 0
Views: 2852
Reputation: 7392
You need to reinstall Authen::SASL - it was installed incorrectly. Do this as root from command line:
cpan GBARR/Authen-SASL-2.15.tar.gz
Upvotes: 2