Net::IMAP::Simple

J

Joe Hasting

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();
 
S

Sam Holden

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,019
Latest member
RoxannaSta

Latest Threads

Top