http://qs321.pair.com?node_id=203361

perrin has asked for the wisdom of the Perl Monks concerning the following question:

Has anyone used any IMAP module successfully to read a mailbox on an MS Exchange server? I've tried Net::IMAP::Simple and Mail::IMAPClient, with no luck so far.

Here's some code that I'm using with Mail::IMAPClient:

my $FOLDER_NAME = 'inbox'; my $server = Mail::IMAPClient->new( Server => $MAIL_SERVER, User => $MAIL_USER, Password => $MAIL_PASS, Fast_IO => 0, Uid => 1, Debug => 1, ); my @folders = @{$server->folders($FOLDER_NAME)}; foreach my $fold (@folders) { print "Processing folder $fold\n"; $server->select($fold); my @msgs = $server->search("ALL"); foreach my $msg (@msgs) { print "Processing message $msg in folder $fold.\n"; my $string = $server->message_string($msg); print "String = $string\n"; } }
This results in a correct login, but then gives the following errors:
Sending: 2 LIST "" "inbox" Sent 19 bytes Read: 2 NO There is no replica for that mailbox on this server. Use of uninitialized value in pattern match (m//) at d:/Perl/site/lib/ +Mail/IMAPClient.pm line 294. Use of uninitialized value in string eq at d:/Perl/site/lib/Mail/IMAPC +lient.pm line 296. Use of uninitialized value in length at d:/Perl/site/lib/Mail/IMAPClie +nt.pm line 296. Use of uninitialized value in substr at d:/Perl/site/lib/Mail/IMAPClie +nt.pm line 296. substr outside of string at d:/Perl/site/lib/Mail/IMAPClient.pm line 2 +96. Use of uninitialized value in concatenation (.) or string at d:/Perl/s +ite/lib/Mail/IMAPClient.pm line 1291. Sending: 3 LIST "" "inbox*" Sent 20 bytes Read: 3 OK LIST completed. Autoloading: STATUS "inbox" (MESSAGES) Sending: 4 STATUS "inbox" (MESSAGES) Sent 29 bytes Read: 4 NO There is no replica for that mailbox on this server.
Note that I can't use Win32-specific modules for this because I am building it to run on a Solaris server.