Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

IMAP modules and MS Exchange

by perrin (Chancellor)
on Oct 07, 2002 at 15:40 UTC ( #203361=perlquestion: print w/replies, xml ) Need Help??

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.

Replies are listed 'Best First'.
Re: IMAP modules and MS Exchange
by jlongino (Parson) on Oct 07, 2002 at 17:12 UTC
    I'd recommend testing your script on the Solaris side first, if you haven't already :). Update: What I mean is to test the script on a Solaris mail account first. I'm not sure this was clear after re-reading my post.

    The only part I'm not so sure about is where you use:

    my @folders = @{$server->folders($FOLDER_NAME)};
    Since you've defined $FOLDER_NAME to be 'inbox' and there aren't usually any subfolders of inbox (I'm not too familiar with MS Exchange formats, so I could be wrong on this). This alone doesn't explain the messages you're getting though. That's why I'd recommend trying the program out one the Unix side first and then MS Exchange once the kinks have been smoothed out.

    --Jim

      Thanks, the folder name was correct, but it turned out that the setup they use here has some mailboxes on one server and others another. So basically, it was all just a configuration problem. I'm going to slink off and lick my wounds somewhere.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://203361]
Approved by erikharrison
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (2)
As of 2021-12-07 00:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    R or B?



    Results (33 votes). Check out past polls.

    Notices?