This module provides perl routines that simplify a sockets connection to and an IMAP conversation with an IMAP server WWW: http://search.cpan.org/dist/Mail-IMAPClient/