mail::box::imap

Tom Allison <[email protected]> Sun, 19 Dec 2004 08:08:44 -0500
Newsgroups gmane.comp.lang.perl.modules.mail-box
Message-ID <[email protected]>
I was doing a little work on a mail::Box project that's in a fairly 
primitive stage.

I have a large learning curve on this Mail::Box::Imap stuff so I'll keep 
my questions to a minimum until I get some reading done.

First a question on code:

my $mgr = new Mail::Box::Manager;
$mgr->defaultTrace('WARNINGS','DEBUG');
print join ("\n", $mgr->folderTypes),"\n";
my $login = "imap4://$username:$password\@$server/";
print $login,"\n";
my $folder = $mgr->open($login);

Watching the DEBUG information shows that the $mgr->open():

DEBUG: Using Mail::IMAPClient version 2.2.9 and perl version 5.8.4 
(5.008004)
DEBUG: Read: * OK dovecot ready.
DEBUG: Connect: Received this from readline: 0/OUTPUT/* OK dovecot ready.
DEBUG: Read: * OK dovecot ready.
DEBUG: Connect: Received this from readline: 1/OUTPUT/* OK dovecot ready.
DEBUG: Sending: 1 AUTHENTICATE CRAM-MD5
DEBUG: Sent 25 bytes
DEBUG: Read: 1 NO Authentication failed: Unsupported authentication 
mechanism
DEBUG: Read: * BYE Disconnected for inactivity.
DEBUG: Read: * OK dovecot ready.
DEBUG: Connect: Received this from readline: 3/OUTPUT/* OK dovecot ready.
DEBUG: Sending literal string in two parts: 2 Login "tallison" {5}
         then: SECRET
DEBUG: Sending: 2 Login "XXXXX" {5}
DEBUG: Sent 24 bytes
DEBUG: Read: + OK


I was having a hard time finding any details on the Authentication 
mechanism.  I really need to specify to be PLAINTEXT first.  Could 
someone point me to the right RFM?  Right now I'm not interested in 
changing the Auth mechanism becuase it's only on a localhost loop network...


The other thing that I'm stuck on is on an example in the docs:

my $client = Mail::IMAPClient->new(...);
my $imap   = Mail::Box::IMAP4->new(imap_client => $client);

my $mgr = new Mail::Box::Manager;
my $folder = $mgr->open($login);

It seems that the first example works very fast for me (partly because 
of the Auth model problem described above) but being able to lump things 
together under a Mail::Box::Manager would be useful because of the 
different file based tools available.

But on the first example, I can set/change folders very easily and 
simply.  But with the Manager I'm having a little trouble with changing 
folders.  I'm concerned that every time I open/close a folder I'm 
logging in/out of the server.  More traffic than needed.  Is this an 
unfounded concern?  Does Mail::Box keep track of the number of folders 
and maintain a connection?

Also, how could I create an object relationship between Mail::IMAPClient 
and Mail::Box::Manager so that an IMAPClient could be handled by a 
Mail::Box::Manager.

I know a lot of the documentation is a little raw under the IMAP stuff 
because it's still under development.  But if there's anything I missed 
on this, please don't hesisitate to point me...