|
Posted by jis on August 19, 2007, 1:26 pm
Please log in for more thread options
> Hi jis.
>
> jis wrote:
> > #!/usr/bin/perl
> > use Mail::Sender;
> > $sender = new Mail::Sender
> > {smtp => 'smtp.gmail.com', from => 'jisma...@gmail.com'};
>
> > $sender->MailFile({to => 'jisma...@gmail.com',
> > subject => 'Here is the file',
> > msg => "I'm sending you the list you wanted."});
>
> > But gave me the error
> > "Cant call the method mailfile without a package or object reference"
>
> That can't be the actual error message, since the method you tried was
> MailFile - perl is case sensitive.
>
> If you read the manual, it says that what the constructor (new) will
> return in case of problems is an error code. Try printing $sender like
> so right after instantiating it:
>
> print "I got this result from new(): $sender\n";
>
> If it is numeric, its an error code. Look it up in the manual.
>
> Also, it seems that MailFile expects a file key in the hash you pass to
> it. See the manual for more info.
>
> Regards,
>
> Michael.
Yes,It was my mistake.
I modified the code like
use strict;
use Mail::Sender;
my $smtp = 'smtp.gmail.com';
my $subj = 'mail sender test';
my $admn = 'j******a@gmail.com';
my $body = 'HOWDY';
my $sender = new Mail::Sender {smtp => $smtp, from => $admn,to =>
$admn, subject => $subj};
$sender->Open({
to => $admn,
subject => $subj,
});
$sender->Close();
if( $Mail::Sender::Error) {
print "Error sending mail: $Mail::Sender::Error \n";
} else { print "Sent ok to $admn $Mail::Sender::Error \n"; }
But
I got the error message "LOGIN not accepted".
I guess it is the authentication protocol that stops me.
But I wonder how I can get over it.This module supports only LOGIN,
PLAIN, CRAM-MD5 and NTLM.I am not sure which shic server uses these
protocols.
Any ideas. All I need is to send email through my script.
Please help.
Cheers,
jishnu
|