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.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.