|
Posted by 50295 on May 19, 2005, 10:33 am
Please log in for more thread options
Hi!
I'm trying to get this short email script to work:
####################################################
#!/usr/bin/perl -w
use strict;
use warnings;
use Net::SMTP;
use Net::POP3;
my $mailhost = "smtp.mail.net";
my $mailobj = "";
if($mailobj = Net::SMTP->new($mailhost, Timeout=>10, Debug=>0)){
print("Connected to $mailhost\n");
} else {
print("Could not connect to $mailhost\n");
die;
}
my $username = "nobody\@mail.net";
my $password = "secret";
my $Rx1 = "invisible\@email.net";
my $Rx2 = "nonsense\@web.net";
my $from = "nobody\@mail.net";
$mailobj->mail($from);
$mailobj->recipient($Rx1, $Rx2,);
if($mailobj->data()){
$mailobj->datasend("To:$Rx1\r\n");
$mailobj->datasend("cc:$Rx2\r\n");
$mailobj->datasend("Subject: Email from Perl script using web.de
with authentication\r\n");
$mailobj->datasend("This is a test message\n");
print("Data sent successfully \n");
} else {
print("Send failed\n");
}
$mailobj->dataend() ;
$mailobj->quit;
#################################
It works fine on WinXP but fails on Linux Redhat with the following
error:
Can't locate Authen/SASL.pm in @INC (@INC contains:
/usr/lib/perl5/5.8.0/i386-linux-thread-multi /usr/lib/perl5/5.8.0
/usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi
/usr/lib/perl5/site_perl/5.8.0 /usr/lib/perl5/site_perl
/usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi
/usr/lib/perl5/vendor_perl/5.8.0 /usr/lib/perl5/vendor_perl
/usr/lib/perl5/5.8.0/i386-linux-thread-multi /usr/lib/perl5/5.8.0 .) at
/usr/lib/perl5/5.8.0/Net/SMTP.pm line 101.
What can I do about this error?
Thanks,
- Olumide
|
|
Posted by Gunnar Hjalmarsson on May 19, 2005, 8:59 pm
Please log in for more thread options
The subject line does not match the rest of the message.
Anyway, in a sub-thread in clpmisc you explained that you need to send
emails with authentication, so the Mail::Sender module is problably a
good tool. Install it, and follow the Mail::Sender documentation.
Btw, Mail::Sender is a plain Perl module, so if you can't install it the
regular way, you can just place Mail/Sender.pm in any suitable directory.
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
|
| Similar Threads | Posted | | Can't locate object method "new" via package "Net::SMTP" | November 2, 2004, 6:36 pm |
| SMTP::new() | October 11, 2005, 2:36 am |
| Net::SMTP | July 25, 2006, 8:44 am |
| net smtp help | October 24, 2006, 4:02 pm |
| Net::Telnet and SMTP | June 13, 2005, 11:01 am |
| Question on NET::SMTP new() | October 11, 2005, 2:32 am |
| SMTP: "to" or/and "recipient" question. | November 11, 2005, 8:52 am |
| Net::SMTP Can't get AUTH working... | November 2, 2006, 5:39 pm |
| Installing Net::SMTP as non-root | March 19, 2007, 4:03 pm |
| "Host =>" in the Net::SMTP module | August 15, 2007, 8:37 am |
|