Howdy all,
I'm trying to test a simple plain email sending bit of code.
When I run the script below I get this:
... Error sending mail:
Perl- :
Module- Connection not established
I can do this via Net::SMTP and all is well (OUTPUT FORM IT BELOW _Net:SMTP_)
I know Mail::Sender can send mail at the server because I have a scirpt that attaches
a pdf file and mails it away and that is going peachy as well.
I'm assuming I'm not doing the Mail::Sender thibg wrong but the only
differences I can think of between what is below and the one that works are:
1) The variable aren't double quoted
2) I removed the section that adds the pdf
What am I completely and utterly missing /doing wrong?
TIA
Dan
-------------------------
#!/usr/bin/perl -w
use strict;
use Mail::Sender;
my $smtp = 'ip of mailserver this script is on';
my $subj = 'mail sender test';
my $admn = '[EMAIL PROTECTED]';
my $body = 'HOWDY';
eval {
my $sender = new Mail::Sender {smtp => $smtp, from => $admn,to =>
$admn, subject => $subj};
$sender->Body({
ctype => 'text/plain',
msg => $body
});
$sender->Close();
};
if($@ || $Mail::Sender::Error) {
print "... Error sending mail: \nPerl- $@ : \nModule-
$Mail::Sender::Error \n";
} else { print "Sent ok to $admn $Mail::Sender::Error \n"; }
--------------------------
_Net::SMTP_
DEBUG CODE :
Net::SMTP: Net::SMTP(2.22)
Net::SMTP: Net::Cmd(2.21)
Net::SMTP: Exporter
Net::SMTP: IO::Socket::INET
Net::SMTP: IO::Socket(1.1603)
Net::SMTP: IO::Handle(1.1505)
Net::SMTP=GLOB(0x80578a8)<<< 220 q42.infiniplex.net ESMTP
Net::SMTP=GLOB(0x80578a8)>>> EHLO localhost.localdomain
Net::SMTP=GLOB(0x80578a8)<<< 250-q42.infiniplex.net
Net::SMTP=GLOB(0x80578a8)<<< 250-PIPELINING
Net::SMTP=GLOB(0x80578a8)<<< 250 8BITMIME
Net::SMTP=GLOB(0x80578a8)>>> MAIL FROM:<[EMAIL PROTECTED]>
Net::SMTP=GLOB(0x80578a8)<<< 250 ok
Net::SMTP=GLOB(0x80578a8)>>> RCPT TO:<[EMAIL PROTECTED]>
Net::SMTP=GLOB(0x80578a8)<<< 250 ok
Net::SMTP=GLOB(0x80578a8)>>> DATA
Net::SMTP=GLOB(0x80578a8)<<< 354 go ahead
Net::SMTP=GLOB(0x80578a8)>>> To: [EMAIL PROTECTED]
Net::SMTP=GLOB(0x80578a8)>>> From: [EMAIL PROTECTED]
Net::SMTP=GLOB(0x80578a8)>>> Subject: Quit talking to yourself -
Net::SMTP=GLOB(0x80578a8)>>>
Net::SMTP=GLOB(0x80578a8)>>> Look at who this is from. Did you really send this to
yourself? I think not!
Net::SMTP=GLOB(0x80578a8)>>> .
Net::SMTP=GLOB(0x80578a8)<<< 250 ok 1059062370 qp 35700
Net::SMTP=GLOB(0x80578a8)>>> QUIT
Net::SMTP=GLOB(0x80578a8)<<< 221 q42.infiniplex.net
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]