=head1 NAME HTML::FromMail::Message - output a message as HTML =head1 INHERITANCE HTML::FromMail::Message is a HTML::FromMail::Page is a HTML::FromMail::Object is a Mail::Reporter =head1 SYNOPSIS =head1 DESCRIPTION THIS MODULE IS UNDER CONSTRUCTION. However, a lot of things already work. Best take a look at the examples directory. =head1 METHODS $obj-EB(MESSAGE, PART, ARGS) =over 4 Create an attachment file, and return a hash with information about that file. Returns C if creation fails. This method is used by L and L to create an actual attachment file. It defines C, C and C tags for the template. Option--Default outdir . outdir => DIRECTORY =over 4 The name of the directory where the external file will be produced must be part of the ARGS hash. =back =back $obj-EB(MESSAGE, PART, ARGS) =over 4 Returns a string, which is either C, C, or C, which indicates how the part of the message should be formatted. This can be changed with setting C. =back $obj-EB =over 4 Returns the field text producing object. =back $obj-EB
=over 4 Returns the header text producting object. =back $obj-EB(MESSAGE, ARGS) =over 4 Produce data about addresses which are in the field. This method uses L for that. =back $obj-EB =over 4 The C container defines C, C and C tags for the template. I using L =back $obj-EB(MESSAGE, ARGS) =over 4 Produce the body of a field. This tag can only be used inside a field container. See L for the use and options. =back $obj-EB(MESSAGE, ARGS) =over 4 Returns the field definition for the currently active message part. When the formatter sees this is a final token, then only the body of the field is returned (and the options of L are accepted as well). Otherwise, the information about the field is captured to be used later. Option--Default decode if possible from PART name . decode => BOOLEAN . from => PART|PARENT|MESSAGE =over 4 The source of this field: the currently active PART (which may be the main message), the PARENT of the active part (defaults to the message), or the main MESSAGE itself. =back . name => STRING I using L =back $obj-EB(MESSAGE, ARGS) =over 4 Produces html for the parts of a multipart mesasge body. Each part may be a multipart too. For each part, the C container code is applied recursively. This container defines a C, and enables the use of the C tag. I using L
  • This is part
=back $obj-EB(MESSAGE, ARGS) =over 4 Defines the fields of a header. The options are provided by L. I using L # simple
# complex
=back $obj-EB =over 4 Option--Default type '' . type => MIME-TYPE =over 4 Selects the MIME types which are handled by this singlepart block. You can specify the types as defined by MIME::Type subroutine equal. =back I using L =back $obj-EB(MESSAGE, ARGS) =over 4 Encapsulated code which is producing the message, which may be a multipart. You have to defined the message block when you use the part (see L) tag. If you do not use that, you do not need this. I using L This is an inlined singlepart This is an attachment An attachment with preview This is a multipart message/rfc822 encapsulated =back $obj-EB(MESSAGE, ARGS) =over 4 Encapsulates text to be produced when the message(-part) is a multipart. =back $obj-EB(MESSAGE, ARGS) =over 4 Produce the name of a field. This tag can only be used inside a field container. See L for the use and options. =back $obj-EB(MESSAGE, ARGS) =over 4 Contains text to be produced when the message(-part) is a nested message; encapsulated in a message/rfc822. =back $obj-EB(MESSAGE, ARGS) =over 4 Apply the C container of the current part on its data. See example in L. =back $obj-EB =over 4 Option--Default type '' . type => MIME-TYPE =over 4 Selects the MIME types which are handled by this singlepart block. You can specify the types as defined by MIME::Type subroutine equal. The C container defines C, C and C tags for the template, which describe the attachment file. Besides, it preview defines a tag which tells whether the preview is made as C or as C. Within an C block, you will get an extra C which includes the actual html preview text. The C container provides more tags: C, C, C, C, and C. =back I using L
(real is x ) Attachment of ( bytes) =back $obj-EB(MESSAGE, ARGS) =over 4 Returns the plain text of the body. =back $obj-EB(MESSAGE, ARGS) =over 4 Get the subject field from the message's header, just a short-cut for specifying L with C. I using L # message subject # part's subject # message subject =back $obj-EB(MIME-TYPE) =over 4 Returns the code reference for a routine which can create html for the objects of the specified MIME-TYPE. The TYPE may be a (smartly overloaded) L object. The behaviour can be changed with the C setting. =back $obj-EB(LABEL, ARGS) =over 4 See L =back HTML::FromMail::Message-EB(OPTIONS) =over 4 Option --Defined in --Default settings HTML::FromMail::Object {} topic HTML::FromMail::Object 'message' . settings => HASH-OF-HASHES . topic => STRING =back $obj-EB(MIME-TYPE) =over 4 Returns the code reference for a routine which can create a preview for the objects of the specified MIME-TYPE. The TYPE may be a (smartly overloaded) L object. The behaviour can be changed with the C setting. =back =head2 Attributes $obj-EB([TOPIC]) =over 4 See L =back $obj-EB =over 4 See L =back =head2 Export =head2 Other methods $obj-EB(STRING) =over 4 See L =back =head1 DETAILS =head2 Settings You can specify the following settings in L for topic C: =head3 disposition CODE Message parts have to be displayed. There are a few ways to do that: by C, C, and C. In the first case, the text of the part is inserted in the main page, in the other two as link to an external file. The latter is creating a small preview of the attachement. The message may provide an indication of the way the part should be displayed in the C field. For many reasons, an exception will be made... for instance, binary messages will never be inlined. You can create your own code reference to change the behavior of the default algorithm. I of own disposition rules my $f = HTML::FromMail->new ( settings => { message => { disposition => \&my_disposer } } ); sub my_disposer($$$$$) { my ($obj, $message, $part, $suggestion, $args) = @_; return 'attach' if $suggestion eq 'inline' && $part->size > 10_000; $suggestion; } =head3 previewers ARRAY-OF-PAIRS For some kinds of message parts, previews can be produced. This ordered list of PAIRS contains mime type with code reference combinations, each describing such a production. The specified items are added before the default list of preview generators. An C as code reference will cause the default preview producer to be disabled. Method L is called when a previewer for a certain content type has to be looked-up. The default previewers are defined (and implemented) in HTML::FromMail::Default::Previewers. =head3 htmlifiers ARRAY-OF-PAIRS Some kinds of information can be translated into HTML. When a data type defines such a translation, it may be inlined (see L), where in other cases it will get attached. The usage is the same as for the C option. Method L is called when a htmlifier for a certain content type has to be looked-up. The default htmlifiers are defined (and implemented) in HTML::FromMail::Default::HTMLifiers. I use own converters my @prevs = ( 'text/postscript' => \&prepost , 'image' => \&imagemagick ); my @html = ( 'text/html' => \&strip_html , 'text/plain' => \&plain2html ); my $f = HTML::FromMail->new ( settings => { message => { previewers => \@prevs , htmlifiers => \@html , disposition => \&my_disposer } } ); sub prepost($$$$$) { my ($page, $message, $part, $attach, $args) = @_; # args contains extra info from template # returns a hash of info which is used in a # preview block (see htmlPreview()) } =head1 DIAGNOSTICS I No field name specified in $template I foreachPart not used within part I foreachPart outside multipart I use of 'addresses' outside field container I use of 'body' outside field container I use of 'name' outside field container =head1 SEE ALSO This module is part of HTML-FromMail distribution version 0.11, built on June 08, 2007. Website: F =head1 LICENSE Copyrights 2003,2004,2007 by Mark Overmeer. For other contributors see ChangeLog. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See F