Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Net::IMAP::Simple

Reply
Thread Tools

Net::IMAP::Simple

 
 
Joe Hasting
Guest
Posts: n/a
 
      07-28-2003
I am re-posting to see if anyone has a suggestion, or experience using this
module.:


------------------------------------------------------
I would like to use the IMAP:Simple module to poll a IMAP server. I want to
look at messages and search the subject and body for a string. I got the
sample script from CPAN (below), but I can't get it to work. I changed
someserver to my IMAP server, and someuser, somepassword, and somefolder to
the appropriate values, but when I run it it returns immediatly with no
responce (I can use a mail client and see me mesages in the folder on my
IMAP server). Can someone let me know how I can check to see if I am
logging into the server, or an alternate method that has worked for use to
read IMAP.

thanks
J


use Net::IMAP::Simple;


# open a connection to the IMAP server
$server = new Net::IMAP::Simple( $self->param( 'someserver' ) );

# login
$server->login( 'someuser', 'somepassword' );

# select the desired folder
$number_of_messages = select( 'somefolder' );

# go through all the messages in the selected folder
foreach $msg ( 1..$number_of_messages ) {

# get the message
$lines = $server->get( $msg );

# print it
print @$lines;
}

# the list of all folders
@folders = $server->mailboxes();

# create a folder
$server->create_mailbox( 'newfolder' );

# rename a folder
$server->rename_mailbox( 'newfolder', 'renamedfolder' );

# delete a folder
$server->delete_mailbox( 'renamedfolder' );

# copy a message to another folder
$server->copy( $self, $msg, 'renamedfolder' );

# close the connection
$server->quit();



 
Reply With Quote
 
 
 
 
Sam Holden
Guest
Posts: n/a
 
      07-28-2003
On Mon, 28 Jul 2003 11:30:09 -0400, Joe Hasting <(E-Mail Removed)> wrote:
> I am re-posting to see if anyone has a suggestion, or experience using this
> module.:


Ask perl for help (by enabling warnings, and prevent silly errors
by also using "use strict;").

What do you think $self is? What does perl think it is? What makes
you think it has a param method?

It has been over *three and a half years* since the documentation
of that module was corrected. Why are you still using the incorrect
example (which was corrected *five days* after it was released)?

[snip buggy example code from Net::IMAP::Simple 0.90 docs]

That module hasn't been updated for a long time, if it works then
I guess it'll do fine. But something like Mail::IMAPClient seems to
be under more active development.

--
Sam Holden

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off




Advertisments