SYNOPSIS

 use Mail::Message;   # part of Mail::Box
 use HTML::FromMail;

 my $msg    = Mail::Message->read(\*STDIN);
 my $fmt    = HTML::FromMail->new(templates => 'templ');
 my $output = $fmt->export($msg, output => $tempdir);

 # See full example in examples/msg2html.pl

See SYNOPSIS in Mail::Reporter

DESCRIPTION

This module, HTML::FromMail, is designed to put e-mail related data on web-pages. This could be used to create web-mail clients.

See DESCRIPTION in Mail::Reporter

Status

Plans

There are many extensions planned; but I have no time to implement them.

DETAILS

Producers

Producers are sets of methods which can be used to produce HTML for a specific object. For instance, the HTML::FromMail::Message produces output for Mail::Message objects. You can add and overrule producers via new(producers) and producer().

On the moment, the following producers are defined. When marked with a (*), the implementation is not yet finished.

 Mail::Message            HTML::FromMail::Message
 Mail::Message::Head      HTML::FromMail::Head
 Mail::Message::Field     HTML::FromMail::Field
 Mail::Message::Body      HTML::FromMail::Body      *
 Mail::Box                HTML::FromMail::Box       *
 Mail::Box::Thread::Node  HTML::FromMail::Thread    *

Settings

Each producer has one single topic, but there may be multiple alternatives for one topic. The topic is configurable with HTML::FromMail::Object::new(topic).

For each item which is converted to HTML, one of the producers for that item is created. The topic of the producer is used to select a group of settings to be used as changes on the defaults. These values are used for the formatter as well as the producer when formatting that topic.

An example should clarify things a little:

 my $fmt = HTML::FromMail->new
   ( settings =>
       { message =>
           { previewers    => \@my_prevs
           , disposition   => sub { 'attach' }
           }
       , field   => { }
       }
   );
 print $fmt->export($msg, output => '/tmp/x');

For settings available for messages, see Settings.