Click here to get back home

Mail::Sender problem

 HomeNewsGroups | Search | About
 comp.lang.perl.modules    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
Mail::Sender problem jis 08-17-2007
Posted by jis on August 17, 2007, 10:20 am
Please log in for more thread options


Hi,

I tried

#!/usr/bin/perl
use Mail::Sender;
$sender = new Mail::Sender
{smtp => 'smtp.gmail.com', from => 'jismagic@gmail.com'};

$sender->MailFile({to => 'jismagic@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"

Pls help. I am using WIndows Xp and iam using mail::Sender 0.8.13.

regards,
jis


Posted by Gunnar Hjalmarsson on August 17, 2007, 9:39 pm
Please log in for more thread options


jis wrote:
> I tried
>
> #!/usr/bin/perl
> use Mail::Sender;
> $sender = new Mail::Sender
> {smtp => 'smtp.gmail.com', from => 'jismagic@gmail.com'};
>
> $sender->MailFile({to => 'jismagic@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"

Can't reproduce that error msg, but I know that the MailFile method
expects a file... Please post your actual code that generated the above
error message.

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl

Posted by Michael Zedeler on August 18, 2007, 5:30 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 => 'jismagic@gmail.com'};
>
> $sender->MailFile({to => 'jismagic@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.

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


Posted by Gunnar Hjalmarsson on August 19, 2007, 8:43 pm
Please log in for more thread options


jis wrote:
> 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.

Either use a mail server that does not need authentication (the server
of your Internet access provider, perhaps?), or provide the requested
login info.

> This module supports only LOGIN, PLAIN, CRAM-MD5 and NTLM.I am not
> sure which shic server uses these protocols.

Mail::Sender has a method for finding out which protocols are supported
by a particular server.

http://search.cpan.org/perldoc?Mail%3A%3ASender#AUTHENTICATION

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl

Similar ThreadsPosted
Mail:Sender - HTML Mail with alternatives problem July 21, 2004, 6:44 pm
Module problem - Can't locate Mail/Sender.pm in @INC October 22, 2004, 11:19 am
Mail::Sender, attachments and html together August 4, 2004, 9:48 am
Mail::Sender: Encoding of subject November 17, 2004, 12:56 am
Net::SMTP error: Can't locate Mail/Sender.pm in @INC May 19, 2005, 10:33 am
Found problem in Mail-SpamAssassin-2.xx causing build failure onwin32 August 1, 2004, 9:33 pm
Mail::Audit help plz October 26, 2005, 8:18 pm
Mail::Vacation abondoned? August 11, 2004, 3:13 pm
Mail::Audit Question August 30, 2004, 12:55 am
Mail::Message::TransferEnc February 2, 2005, 4:19 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap