1Mail::Message::Convert:U:sHetrmlC(o3n)tributed Perl DocuMmaeinlt:a:tMieosnsage::Convert::Html(3)
2
3
4
6 Mail::Message::Convert::Html - Format messages in HTML
7
9 Mail::Message::Convert::Html
10 is a Mail::Message::Convert
11 is a Mail::Reporter
12
14 use Mail::Message::Convert::Html;
15 my $Html = Mail::Message::Convert::Html->new;
16
17 print $html->fieldToHtml($head);
18 print $html->headToHtmlHead($head);
19 print $html->headToHtmlTable($head);
20 print $html->textToHtml($text);
21
23 The package contains various translators which handle HTML or XHTML
24 without the help of external modules. There are more HTML related
25 modules, which do require extra packages to be installed.
26
27 Extends "DESCRIPTION" in Mail::Message::Convert.
28
30 Extends "METHODS" in Mail::Message::Convert.
31
32 Constructors
33 Extends "Constructors" in Mail::Message::Convert.
34
35 Mail::Message::Convert::Html->new(%options)
36 -Option --Defined in --Default
37 fields Mail::Message::Convert <see description>
38 head_mailto <true>
39 log Mail::Reporter 'WARNINGS'
40 produce HTML
41 trace Mail::Reporter 'WARNINGS'
42
43 fields => NAMES|ARRAY-OF-NAMES|REGEXS
44 head_mailto => BOOLEAN
45 Whether to replace e-mail addresses in some header lines with
46 links.
47
48 log => LEVEL
49 produce => 'HTML'|'XHTML'
50 Produce HTML or XHTML output. The output is slightly different,
51 even html browsers will usually accept the XHTML data.
52
53 trace => LEVEL
54
55 Converting
56 Extends "Converting" in Mail::Message::Convert.
57
58 $obj->fieldContentsToHtml( $field, [$subject] )
59 Format one field from the header to HTML. When the header line
60 usually contains e-mail addresses, the line is scanned and valid
61 addresses are linked with an "mailto:" anchor. The $subject can be
62 specified to be included in that link.
63
64 $obj->fieldToHtml( $field, [$subject] )
65 Reformat one header line field to HTML. The $field's name is
66 printed in bold, followed by the formatted field content, which is
67 produced by fieldContentsToHtml().
68
69 $obj->headToHtmlHead($head, $meta)
70 Translate the selected header lines (fields) to an html page
71 header. Each selected field will get its own meta line with the
72 same name as the line. Furthermore, the "Subject" field will
73 become the "title", and "From" is used for the "Author".
74
75 Besides, you can specify your own meta fields, which will overrule
76 header fields. Empty fields will not be included. When a "title"
77 is specified, this will become the html title, otherwise the
78 "Subject" field is taken. In list context, the lines are
79 separately, where in scalar context the whole text is returned as
80 one.
81
82 If you need to add lines to the head (for instance, http-equiv
83 lines), then splice them before the last element in the returned
84 list.
85
86 example:
87
88 my @head = $html->headToHtmlHead
89 ( $head
90 , description => 'This is a message'
91 , generator => 'Mail::Box'
92 );
93 splice @head, -1, 0, '<meta http-equiv=...>';
94 print @head;
95
96 $obj->headToHtmlTable( $head, [$table_params] )
97 Produce a display of the selectedFields() of the header in a table
98 shape. The optional $table_params are added as parameters to the
99 produced TABLE tag. In list context, the separate lines are
100 returned. In scalar context, everything is returned as one.
101
102 example:
103
104 print $html->headToHtmlTable($head, 'width="50%"');
105
106 $obj->selectedFields($head)
107 Inherited, see "Converting" in Mail::Message::Convert
108
109 $obj->textToHtml($lines)
110 Translate one or more $lines from text into HTML. Each line is
111 taken one after the other, and only simple things are translated.
112 "textToHtml" is able to convert large plain texts in a descent
113 fashion. In scalar context, the resulting lines are returned as
114 one.
115
116 Error handling
117 Extends "Error handling" in Mail::Message::Convert.
118
119 $obj->AUTOLOAD()
120 Inherited, see "Error handling" in Mail::Reporter
121
122 $obj->addReport($object)
123 Inherited, see "Error handling" in Mail::Reporter
124
125 $obj->defaultTrace( [$level]|[$loglevel, $tracelevel]|[$level,
126 $callback] )
127 Mail::Message::Convert::Html->defaultTrace( [$level]|[$loglevel,
128 $tracelevel]|[$level, $callback] )
129 Inherited, see "Error handling" in Mail::Reporter
130
131 $obj->errors()
132 Inherited, see "Error handling" in Mail::Reporter
133
134 $obj->log( [$level, [$strings]] )
135 Mail::Message::Convert::Html->log( [$level, [$strings]] )
136 Inherited, see "Error handling" in Mail::Reporter
137
138 $obj->logPriority($level)
139 Mail::Message::Convert::Html->logPriority($level)
140 Inherited, see "Error handling" in Mail::Reporter
141
142 $obj->logSettings()
143 Inherited, see "Error handling" in Mail::Reporter
144
145 $obj->notImplemented()
146 Inherited, see "Error handling" in Mail::Reporter
147
148 $obj->report( [$level] )
149 Inherited, see "Error handling" in Mail::Reporter
150
151 $obj->reportAll( [$level] )
152 Inherited, see "Error handling" in Mail::Reporter
153
154 $obj->trace( [$level] )
155 Inherited, see "Error handling" in Mail::Reporter
156
157 $obj->warnings()
158 Inherited, see "Error handling" in Mail::Reporter
159
160 Cleanup
161 Extends "Cleanup" in Mail::Message::Convert.
162
163 $obj->DESTROY()
164 Inherited, see "Cleanup" in Mail::Reporter
165
167 Error: Package $package does not implement $method.
168 Fatal error: the specific package (or one of its superclasses) does
169 not implement this method where it should. This message means that
170 some other related classes do implement this method however the
171 class at hand does not. Probably you should investigate this and
172 probably inform the author of the package.
173
175 This module is part of Mail-Message distribution version 3.010, built
176 on October 14, 2020. Website: http://perl.overmeer.net/CPAN/
177
179 Copyrights 2001-2020 by [Mark Overmeer <markov@cpan.org>]. For other
180 contributors see ChangeLog.
181
182 This program is free software; you can redistribute it and/or modify it
183 under the same terms as Perl itself. See http://dev.perl.org/licenses/
184
185
186
187perl v5.32.1 2021-01-27 Mail::Message::Convert::Html(3)