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();
This module was only tested under Netscape IMAP4rev1 Service 3.6, so expect some problems with servers from other vendors (then again, if all of them are implementing the IMAP protocol, it should work - but we all know how it goes).