Re: Webmail client

Tom Allison <[email protected]> Mon, 27 Dec 2004 20:35:57 -0500
Newsgroups gmane.comp.lang.perl.modules.mail-box
Message-ID <[email protected]>
Mitar wrote:
> Hi!
> 
> On Tue, 28 Dec 2004 01:16:15 +0100, Mark Overmeer <[email protected]> wrote:
> 
>>* Mitar ([email protected]) [041228 00:50]:
>>
>>>I have been thinking long about making a webmail in Perl with
>>>extensive use of Mail::Box.
>>
>>Last week there was a debate about this as well.  Tom Allison is
>>building something like that, on the moment, using HTML::FromMail
>>and IMAP.
> 
> 
> I know. That is why I started to doubt in Mail::Box efficiency.
> 
> 
>>Keep in mind that MailBox is meant to do e-mail batch-processing,
>>so your performance may be less that you wished for.
> 
> 
> But is not that similar to webmail? Open directory, parse header data
> for all mails, print them, close. :-)
> 
> 

Not really.
Mail::Box may load and parse the complete Header and Body.  I'm hedging 
myself here because I suspect Marks done something to speed this up.

When you look at this from an IMAP perspective, you only need to load a 
limited number of fields (From, Subject, Date, Flags) for each message. 
  IIRC a lot of this might be done in a 'lazy' manner under Mail::Box to 
only read/store in memory what is required at the time.

That and under a webmail interface, you don't read/parse even these 
headers for all email.  If you have 5000 messages, that's a lot of data 
when you typically will only see/view 10-30 at a time.  If you care to 
cache the IMAP query of all 5000 then you might have something there. 
It might even be possible to utilize the IMAP Recent flag to help this 
more but the problem is that only the first session will see the Recent 
flag.  If you have multiple clients on the same folder you get badly out 
of sync.

The leanest method I've found is to capture the UIDS from the IMAP 
server.  They are much like the MessageID's only the IMAP server manages 
them and doesn't need to read the MessageID, which is the normal 
behavior in Mail::Box.  If a cross reference were cached, then you would 
be 1/2 way home.