Re: HTML::FromMail

Mark Overmeer <[email protected]> Tue, 21 Dec 2004 10:11:22 +0100
Newsgroups gmane.comp.lang.perl.modules.mail-box
Organization MARKOV Solutions
Message-ID <[email protected]>
* Tom Allison ([email protected]) [041221 03:56]:
> I am not certain that I will have much benefit to using the 
> Mail::Box::Manager code under an IMAP environment.  Similarly 
> Mail::Box::IMAP4 and other folder related code I might not be picking 
> up.  Yet...  I went back through some old code I found and it seems that 
> a lot of this has already been addressed (by me) using the 
> Mail::IMAPClient as a basis.

Of course, when you have a very specific task at hand, for instance a
webmail client using IMAP, than sticking to the lower level transport
modules (like Mail::IMAPClient) may be most practical.  The less code,
the less bugs.

However, when you use the MailBox abstraction layer over it, your
application is not only suitable for IMAP, but immediately also for
POP and folders on local disks.

>  I'll probably stick with this for now 
> because the UID is a unique reference similar to the messageId but much 
> faster to obtain since I don't have to read in any headers.  At least 
> that's my assumption that the Mail::IMAPClient 'messages' to be faster 
> than going with the fetch(@uids, BODY[HEADER.FIELDS (MESSAGEID)]).

I think you try to use Mail::Transport::IMAP too much.  This is not
meant to be used by an end-user unless last resort.  Mail::Box::IMAP4
is implementing the folder, handing abstract features, and
Mail::Transport::IMAP4 is more like an helper module, hiding some
protocol specifics.  In case of Mail::Transport::POP3, it is the full
POP3 implementation, for IMAP4 it is a wrapper aroung Mail::IMAPClient.

When you user Mail::Box::IMAP4, and get messages/heads/bodies like you
do with other folder types, the required fetches are hidden for you.
These accesses are lazy (message only read when used) and cached.  That
should make life much easier than Mail::IMAPClient is.

> To date, I have managed to capture the mail client equivelants of:
> list of folders with count of new records

  $imap->listSubfolders;

> list of some headers for a selected folder

  print $_->subject for $imap->messages;

> Conceptually I'm guessing that I can do one of the following:
> use the Mail::IMAPClient to fetch the entire message and dump that into 
> a Mail::Message which in turn can be munged into an HTML output.

Possible, my $msg = Mail::Message->read(...);

> Or possibly dump the string for the message directly into the 
> HTML::FromMail module.

Harder...

> However, where I'm really ignorant is the lack of an example/msg2html.pl 
> file on my installation.  I just checked it out from CPAN and couldn't 
> find the file anywhere under /usr.
> Can you help me out with any of this?

There are a few examples is the Html::FromMail distribution.  Under /usr???
of course not.
-- 
               MarkOv

------------------------------------------------------------------------
drs Mark A.C.J. Overmeer                                MARKOV Solutions
       [email protected]                          [email protected]
http://Mark.Overmeer.net                   http://solutions.overmeer.net