Mail-Message-4.02/0000755000175000001440000000000015134356615014432 5ustar00markovusers00000000000000Mail-Message-4.02/lib/0000755000175000001440000000000015134356615015200 5ustar00markovusers00000000000000Mail-Message-4.02/lib/Mail/0000755000175000001440000000000015134356615016062 5ustar00markovusers00000000000000Mail-Message-4.02/lib/Mail/Message/0000755000175000001440000000000015134356615017446 5ustar00markovusers00000000000000Mail-Message-4.02/lib/Mail/Message/Convert/0000755000175000001440000000000015134356615021066 5ustar00markovusers00000000000000Mail-Message-4.02/lib/Mail/Message/Convert/MimeEntity.pm0000644000175000001440000000237215134356601023507 0ustar00markovusers00000000000000# This code is part of Perl distribution Mail-Message version 4.02. # The POD got stripped from this file by OODoc version 3.06. # For contributors see file ChangeLog. # This software is copyright (c) 2001-2026 by Mark Overmeer. # This is free software; you can redistribute it and/or modify it under # the same terms as the Perl 5 programming language system itself. # SPDX-License-Identifier: Artistic-1.0-Perl OR GPL-1.0-or-later package Mail::Message::Convert::MimeEntity;{ our $VERSION = '4.02'; } use parent 'Mail::Message::Convert'; use strict; use warnings; use Log::Report 'mail-message', import => [ qw/__x error/ ]; use MIME::Entity (); use MIME::Parser (); use Mail::Message (); #-------------------- sub export($$;$) { my ($self, $message, $parser) = @_; defined $message or return (); $message->isa('Mail::Message') or error __x"export message must be a Mail::Message object, but is {what UNKNOWN}.", what => $message; $parser ||= MIME::Parser->new; $parser->parse($message->file); } sub from($) { my ($self, $mime_ent) = @_; defined $mime_ent or return (); $mime_ent->isa('MIME::Entity') or error __x"converting from MIME::Entity but got a {class}.", class => ref $mime_ent; Mail::Message->read($mime_ent->as_string); } 1; Mail-Message-4.02/lib/Mail/Message/Convert/HtmlFormatPS.pm0000644000175000001440000000241115134356601023735 0ustar00markovusers00000000000000# This code is part of Perl distribution Mail-Message version 4.02. # The POD got stripped from this file by OODoc version 3.06. # For contributors see file ChangeLog. # This software is copyright (c) 2001-2026 by Mark Overmeer. # This is free software; you can redistribute it and/or modify it under # the same terms as the Perl 5 programming language system itself. # SPDX-License-Identifier: Artistic-1.0-Perl OR GPL-1.0-or-later package Mail::Message::Convert::HtmlFormatPS;{ our $VERSION = '4.02'; } use parent 'Mail::Message::Convert'; use strict; use warnings; use Log::Report 'mail-message', import => [ qw// ]; use Mail::Message::Body::String (); use HTML::TreeBuilder (); use HTML::FormatPS (); #-------------------- sub init($) { my ($self, $args) = @_; my @formopts = map +($_ => delete $args->{$_}), grep m/^[A-Z]/, keys %$args; $self->SUPER::init($args); $self->{MMCH_formatter} = HTML::FormatPS->new(@formopts); $self; } #-------------------- sub format($) { my ($self, $body) = @_; my $dec = $body->encode(transfer_encoding => 'none'); my $tree = HTML::TreeBuilder->new_from_file($dec->file); (ref $body)->new( based_on => $body, mime_type => 'application/postscript', data => [ $self->{MMCH_formatter}->format($tree) ], ); } 1; Mail-Message-4.02/lib/Mail/Message/Convert/TextAutoformat.pm0000644000175000001440000000202515134356601024404 0ustar00markovusers00000000000000# This code is part of Perl distribution Mail-Message version 4.02. # The POD got stripped from this file by OODoc version 3.06. # For contributors see file ChangeLog. # This software is copyright (c) 2001-2026 by Mark Overmeer. # This is free software; you can redistribute it and/or modify it under # the same terms as the Perl 5 programming language system itself. # SPDX-License-Identifier: Artistic-1.0-Perl OR GPL-1.0-or-later package Mail::Message::Convert::TextAutoformat;{ our $VERSION = '4.02'; } use parent 'Mail::Message::Convert'; use strict; use warnings; use Log::Report 'mail-message', import => [ qw// ]; use Text::Autoformat qw/autoformat/; use Mail::Message::Body::String (); #-------------------- sub init($) { my ($self, $args) = @_; $self->SUPER::init($args); $self->{MMCA_options} = $args->{autoformat} || +{ all => 1 }; $self; } #-------------------- sub autoformatBody($) { my ($self, $body) = @_; (ref $body)->new(based_on => $body, data => autoformat($body->string, $self->{MMCA_options})); } 1; Mail-Message-4.02/lib/Mail/Message/Convert/MailInternet.pm0000644000175000001440000000375615134356601024025 0ustar00markovusers00000000000000# This code is part of Perl distribution Mail-Message version 4.02. # The POD got stripped from this file by OODoc version 3.06. # For contributors see file ChangeLog. # This software is copyright (c) 2001-2026 by Mark Overmeer. # This is free software; you can redistribute it and/or modify it under # the same terms as the Perl 5 programming language system itself. # SPDX-License-Identifier: Artistic-1.0-Perl OR GPL-1.0-or-later package Mail::Message::Convert::MailInternet;{ our $VERSION = '4.02'; } use parent 'Mail::Message::Convert'; use strict; use warnings; use Log::Report 'mail-message', import => [ qw/__x error/ ]; use Mail::Internet (); use Mail::Header (); use Mail::Message (); use Mail::Message::Head::Complete (); use Mail::Message::Body::Lines (); #-------------------- sub export($@) { my ($thing, $message) = (shift, shift); $message->isa('Mail::Message') or error __x"export message must be a Mail::Message object, but is {what UNKNOWN}.", what => $message; my $mi_head = Mail::Header->new; foreach my $field ($message->head->orderedFields) { $mi_head->add($field->Name, scalar $field->foldedBody); } Mail::Internet->new(Header => $mi_head, Body => [ $message->body->lines ], @_); } my @pref_order = qw/From To Cc Subject Date In-Reply-To References Content-Type/; sub from($@) { my ($thing, $mi) = (shift, shift); $mi->isa('Mail::Internet') or error __x"converting from Mail::Internet but got {what UNKNOWN}.", what => $mi; my $head = Mail::Message::Head::Complete->new; my $body = Mail::Message::Body::Lines->new(data => [ @{$mi->body} ]); my $mi_head = $mi->head; # The tags of Mail::Header are unordered, but we prefer some ordering. my %tags = map +(lc $_ => ucfirst $_), $mi_head->tags; my @tags; foreach (@pref_order) { push @tags, $_ if delete $tags{lc $_}; } push @tags, sort values %tags; foreach my $name (@tags) { $head->add($name, $_) for $mi_head->get($name); } Mail::Message->new(head => $head, body => $body, @_); } 1; Mail-Message-4.02/lib/Mail/Message/Convert/EmailSimple.pod0000644000175000001440000001003315134356602023764 0ustar00markovusers00000000000000=encoding utf8 =head1 NAME Mail::Message::Convert::EmailSimple - translate Mail::Message to Email::Simple vv =head1 INHERITANCE Mail::Message::Convert::EmailSimple is a Mail::Message::Convert is a Mail::Reporter =head1 SYNOPSIS use Mail::Message::Convert::EmailSimple; my $convert = Mail::Message::Convert::EmailSimple->new; my Mail::Message $msg = Mail::Message->new; my Email::Simple $intern = $convert->export($msg); my Email::Simple $intern = Mail::Internet->new; my Mail::Message $msg = $convert->from($intern); use Mail::Box::Manager; my $mgr = Mail::Box::Manager->new; my $folder = $mgr->open(folder => 'Outbox'); $folder->addMessage($intern); =head1 DESCRIPTION The Email::Simple class is one of the base objects used by the large set of Email* modules, which implement many e-mail needs which are also supported by MailBox. You can use this class to gradularly move from a Email* based implementation into a MailBox implementation. The internals of this class are far from optimal. The conversion does work (thanks to Ricardo Signes), but is expensive in time and memory usage. It could easily be optimized. Extends L<"DESCRIPTION" in Mail::Message::Convert|Mail::Message::Convert/"DESCRIPTION">. =head1 METHODS Extends L<"METHODS" in Mail::Message::Convert|Mail::Message::Convert/"METHODS">. =head2 Constructors Extends L<"Constructors" in Mail::Message::Convert|Mail::Message::Convert/"Constructors">. =over 4 =item $class-EB(%options) Inherited, see L =back =head2 Attributes Extends L<"Attributes" in Mail::Message::Convert|Mail::Message::Convert/"Attributes">. =head2 Converting Extends L<"Converting" in Mail::Message::Convert|Mail::Message::Convert/"Converting">. =over 4 =item $obj-EB($message, %options) Returns a new Email::Simple object based on the information from a L object. The C<$message> specified is an instance of a L. » example: my $convert = Mail::Message::Convert::EmailSimple->new; my Mail::Message $msg = Mail::Message->new; my Mail::Internet $copy = $convert->export($msg); =item $obj-EB($object, %options) Returns a new L object based on the information from an Email::Simple. » example: my $convert = Mail::Message::Convert::EmailSimple->new; my Mail::Internet $msg = Mail::Internet->new; my Mail::Message $copy = $convert->from($msg); =item $obj-EB($head) Inherited, see L =back =head2 Error handling Extends L<"Error handling" in Mail::Message::Convert|Mail::Message::Convert/"Error handling">. =over 4 =item $obj-EB() Inherited, see L =item $obj-EB() Inherited, see L =back =head2 Cleanup Extends L<"Cleanup" in Mail::Message::Convert|Mail::Message::Convert/"Cleanup">. =over 4 =item $obj-EB() Inherited, see L =back =head1 DIAGNOSTICS =over 4 =item Error: class $package does not implement method $method. Fatal error: the specific C<$package> (or one of its superclasses) does not implement this method where it should. This message means that some other related classes do implement this method however the class at hand does not. Probably you should investigate this and probably inform the author of the package. Cast by C =item Error: converting from Email::Simple but got a $class. Cast by C =item Error: export message must be a Mail::Message, but is a $class. Cast by C =back =head1 SEE ALSO This module is part of Mail-Message version 4.02, built on January 22, 2026. Website: F =head1 LICENSE For contributors see file ChangeLog. This software is copyright (c) 2001-2026 by Mark Overmeer. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. Mail-Message-4.02/lib/Mail/Message/Convert/HtmlFormatText.pod0000644000175000001440000000654115134356602024516 0ustar00markovusers00000000000000=encoding utf8 =head1 NAME Mail::Message::Convert::HtmlFormatText - Convert HTML into Text =head1 INHERITANCE Mail::Message::Convert::HtmlFormatText is a Mail::Message::Convert is a Mail::Reporter =head1 SYNOPSIS use Mail::Message::Convert::HtmlFormatText; my $af = Mail::Message::Convert::HtmlFormatText->new; my $plain_body = $af->format($body); =head1 DESCRIPTION Convert HTML/XHTML message body objects into plain text bodies using HTML::FormatText. This package requires HTML::TreeBuilder and HTML::FormatText which are not installed by default together with L. See also L with rule C. This module is a small wrapper around HTML::FormatText. Extends L<"DESCRIPTION" in Mail::Message::Convert|Mail::Message::Convert/"DESCRIPTION">. =head1 METHODS Extends L<"METHODS" in Mail::Message::Convert|Mail::Message::Convert/"METHODS">. =head2 Constructors Extends L<"Constructors" in Mail::Message::Convert|Mail::Message::Convert/"Constructors">. =over 4 =item $class-EB(%options) Inherited, see L -Option --Defined in --Default fields Mail::Message::Convert leftmargin 3 rightmargin 72 =over 2 =item fields => $name|$regex|\@names|\@regexes =item leftmargin => INTEGER The column of the left margin, passed to the formatter. =item rightmargin => INTEGER The column of the right margin, passed to the formatter. =back =back =head2 Attributes Extends L<"Attributes" in Mail::Message::Convert|Mail::Message::Convert/"Attributes">. =head2 Converting Extends L<"Converting" in Mail::Message::Convert|Mail::Message::Convert/"Converting">. =over 4 =item $obj-EB($body) Pass an html/xhtml encoded body, and a plain text body is returned. Characters are translated into Latin1. =item $obj-EB($head) Inherited, see L =back =head2 Error handling Extends L<"Error handling" in Mail::Message::Convert|Mail::Message::Convert/"Error handling">. =over 4 =item $obj-EB() Inherited, see L =item $obj-EB() Inherited, see L =back =head2 Cleanup Extends L<"Cleanup" in Mail::Message::Convert|Mail::Message::Convert/"Cleanup">. =over 4 =item $obj-EB() Inherited, see L =back =head1 DIAGNOSTICS =over 4 =item Error: class $package does not implement method $method. Fatal error: the specific C<$package> (or one of its superclasses) does not implement this method where it should. This message means that some other related classes do implement this method however the class at hand does not. Probably you should investigate this and probably inform the author of the package. Cast by C =back =head1 SEE ALSO This module is part of Mail-Message version 4.02, built on January 22, 2026. Website: F =head1 LICENSE For contributors see file ChangeLog. This software is copyright (c) 2001-2026 by Mark Overmeer. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. Mail-Message-4.02/lib/Mail/Message/Convert/Html.pod0000644000175000001440000001267115134356602022501 0ustar00markovusers00000000000000=encoding utf8 =head1 NAME Mail::Message::Convert::Html - Format messages in HTML =head1 INHERITANCE Mail::Message::Convert::Html is a Mail::Message::Convert is a Mail::Reporter =head1 SYNOPSIS use Mail::Message::Convert::Html; my $Html = Mail::Message::Convert::Html->new; print $html->fieldToHtml($head); print $html->headToHtmlHead($head); print $html->headToHtmlTable($head); print $html->textToHtml($text); =head1 DESCRIPTION The package contains various translators which handle HTML or XHTML without the help of external modules. There are more HTML related modules, which do require extra packages to be installed. Extends L<"DESCRIPTION" in Mail::Message::Convert|Mail::Message::Convert/"DESCRIPTION">. =head1 METHODS Extends L<"METHODS" in Mail::Message::Convert|Mail::Message::Convert/"METHODS">. =head2 Constructors Extends L<"Constructors" in Mail::Message::Convert|Mail::Message::Convert/"Constructors">. =over 4 =item $class-EB(%options) Inherited, see L -Option --Defined in --Default fields Mail::Message::Convert head_mailto true produce HTML =over 2 =item fields => $name|$regex|\@names|\@regexes =item head_mailto => BOOLEAN Whether to replace e-mail addresses in some header lines with links. =item produce => 'HTML'|'XHTML' Produce HTML or XHTML output. The output is slightly different, even html browsers will usually accept the XHTML data. =back =back =head2 Attributes Extends L<"Attributes" in Mail::Message::Convert|Mail::Message::Convert/"Attributes">. =head2 Converting Extends L<"Converting" in Mail::Message::Convert|Mail::Message::Convert/"Converting">. =over 4 =item $obj-EB( $field, [$subject] ) Format one field from the header to HTML. When the header line usually contains e-mail addresses, the line is scanned and valid addresses are linked with an C anchor. The C<$subject> can be specified to be included in that link. =item $obj-EB( $field, [$subject] ) Reformat one header line field to HTML. The C<$field>'s name is printed in bold, followed by the formatted field content, which is produced by L. =item $obj-EB($head, $meta) Translate the selected header lines (fields) to an html page header. Each selected field will get its own meta line with the same name as the line. Furthermore, the C field will become the C, and C<From> is used for the C<Author>. Besides, you can specify your own meta fields, which will overrule header fields. Empty fields will not be included. When a C<title> is specified, this will become the html title, otherwise the C<Subject> field is taken. In list context, the lines are separately, where in scalar context the whole text is returned as one. If you need to add lines to the head (for instance, http-equiv lines), then splice them before the last element in the returned list. » example: my @head = $html->headToHtmlHead( $head, description => 'This is a message', generator => 'Mail::Box', ); splice @head, -1, 0, '<meta http-equiv=...>'; print @head; =item $obj-E<gt>B<headToHtmlTable>( $head, [$table_params] ) Produce a display of the L<selectedFields()|Mail::Message::Convert/"Converting"> of the header in a table shape. The optional C<$table_params> are added as parameters to the produced TABLE tag. In list context, the separate lines are returned. In scalar context, everything is returned as one. » example: print $html->headToHtmlTable($head, 'width="50%"'); =item $obj-E<gt>B<selectedFields>($head) Inherited, see L<Mail::Message::Convert/"Converting"> =item $obj-E<gt>B<textToHtml>($lines) Translate one or more C<$lines> from text into HTML. Each line is taken one after the other, and only simple things are translated. C<textToHtml> is able to convert large plain texts in a descent fashion. In scalar context, the resulting lines are returned as one. =back =head2 Error handling Extends L<"Error handling" in Mail::Message::Convert|Mail::Message::Convert/"Error handling">. =over 4 =item $obj-E<gt>B<AUTOLOAD>() Inherited, see L<Mail::Reporter/"Error handling"> =item $obj-E<gt>B<notImplemented>() Inherited, see L<Mail::Reporter/"Error handling"> =back =head2 Cleanup Extends L<"Cleanup" in Mail::Message::Convert|Mail::Message::Convert/"Cleanup">. =over 4 =item $obj-E<gt>B<DESTROY>() Inherited, see L<Mail::Reporter/"Cleanup"> =back =head1 DIAGNOSTICS =over 4 =item Error: class $package does not implement method $method. Fatal error: the specific C<$package> (or one of its superclasses) does not implement this method where it should. This message means that some other related classes do implement this method however the class at hand does not. Probably you should investigate this and probably inform the author of the package. Cast by C<notImplemented()> =item Error: produce XHTML or HTML, not $what. Cast by C<new()> =back =head1 SEE ALSO This module is part of Mail-Message version 4.02, built on January 22, 2026. Website: F<http://perl.overmeer.net/CPAN/> =head1 LICENSE For contributors see file ChangeLog. This software is copyright (c) 2001-2026 by Mark Overmeer. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. �����������������������������������������������������������������������Mail-Message-4.02/lib/Mail/Message/Convert/HtmlFormatPS.pod�����������������������������������������0000644�0001750�0000144�00000006037�15134356602�024114� 0����������������������������������������������������������������������������������������������������ustar�00markov��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������=encoding utf8 =head1 NAME Mail::Message::Convert::HtmlFormatPS - Convert HTML into PostScript =head1 INHERITANCE Mail::Message::Convert::HtmlFormatPS is a Mail::Message::Convert is a Mail::Reporter =head1 SYNOPSIS use Mail::Message::Convert::HtmlFormatPS; my $af = Mail::Message::Convert::HtmlFormatPS->new; my $postscript = $af->format($body); =head1 DESCRIPTION Translate an HTML/XHTML message body into a postscript body using HTML::FormatPS. Extends L<"DESCRIPTION" in Mail::Message::Convert|Mail::Message::Convert/"DESCRIPTION">. =head1 METHODS Extends L<"METHODS" in Mail::Message::Convert|Mail::Message::Convert/"METHODS">. =head2 Constructors Extends L<"Constructors" in Mail::Message::Convert|Mail::Message::Convert/"Constructors">. =over 4 =item $class-E<gt>B<new>(%options) C<%options> which start with capitals are blindly passed to HTML::FormatPS. As of this writing, that package defines BottomMargin, FontFamily, FontScale, HorizontalMargin, Leading, LeftMargin, PageNo, PaperHeight, PaperSize, PaperWidth, RightMargin, TopMargin, and VerticalMargin. Improves base, see L<Mail::Reporter/"Constructors"> -Option--Defined in --Default fields Mail::Message::Convert <not used> =over 2 =item fields => $name|$regex|\@names|\@regexes =back =back =head2 Attributes Extends L<"Attributes" in Mail::Message::Convert|Mail::Message::Convert/"Attributes">. =head2 Converting Extends L<"Converting" in Mail::Message::Convert|Mail::Message::Convert/"Converting">. =over 4 =item $obj-E<gt>B<format>($body) Pass an html or xhtml encoded body, and a plain text body is returned. Characters are translated into Latin1. =item $obj-E<gt>B<selectedFields>($head) Inherited, see L<Mail::Message::Convert/"Converting"> =back =head2 Error handling Extends L<"Error handling" in Mail::Message::Convert|Mail::Message::Convert/"Error handling">. =over 4 =item $obj-E<gt>B<AUTOLOAD>() Inherited, see L<Mail::Reporter/"Error handling"> =item $obj-E<gt>B<notImplemented>() Inherited, see L<Mail::Reporter/"Error handling"> =back =head2 Cleanup Extends L<"Cleanup" in Mail::Message::Convert|Mail::Message::Convert/"Cleanup">. =over 4 =item $obj-E<gt>B<DESTROY>() Inherited, see L<Mail::Reporter/"Cleanup"> =back =head1 DIAGNOSTICS =over 4 =item Error: class $package does not implement method $method. Fatal error: the specific C<$package> (or one of its superclasses) does not implement this method where it should. This message means that some other related classes do implement this method however the class at hand does not. Probably you should investigate this and probably inform the author of the package. Cast by C<notImplemented()> =back =head1 SEE ALSO This module is part of Mail-Message version 4.02, built on January 22, 2026. Website: F<http://perl.overmeer.net/CPAN/> =head1 LICENSE For contributors see file ChangeLog. This software is copyright (c) 2001-2026 by Mark Overmeer. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Mail-Message-4.02/lib/Mail/Message/Convert/EmailSimple.pm�������������������������������������������0000644�0001750�0000144�00000002410�15134356601�023615� 0����������������������������������������������������������������������������������������������������ustar�00markov��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������# This code is part of Perl distribution Mail-Message version 4.02. # The POD got stripped from this file by OODoc version 3.06. # For contributors see file ChangeLog. # This software is copyright (c) 2001-2026 by Mark Overmeer. # This is free software; you can redistribute it and/or modify it under # the same terms as the Perl 5 programming language system itself. # SPDX-License-Identifier: Artistic-1.0-Perl OR GPL-1.0-or-later package Mail::Message::Convert::EmailSimple;{ our $VERSION = '4.02'; } use parent 'Mail::Message::Convert'; use strict; use warnings; use Log::Report 'mail-message', import => [ qw/__x error/ ]; use Mail::Internet (); use Mail::Header (); use Email::Simple (); use Mail::Message (); use Mail::Message::Head::Complete (); use Mail::Message::Body::Lines (); #-------------------- sub export($@) { my ($thing, $message) = @_; $message->isa('Mail::Message') or error __x"export message must be a Mail::Message, but is a {class}.", class => ref $message; Email::Simple->new($message->string); } sub from($@) { my ($thing, $email) = (shift, shift); $email->isa('Email::Simple') or error __x"converting from Email::Simple but got a {class}.", class => ref $email; Mail::Message->read($email->as_string); } 1; ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Mail-Message-4.02/lib/Mail/Message/Convert/MimeEntity.pod�������������������������������������������0000644�0001750�0000144�00000010352�15134356602�023653� 0����������������������������������������������������������������������������������������������������ustar�00markov��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������=encoding utf8 =head1 NAME Mail::Message::Convert::MimeEntity - translate Mail::Message to MIME::Entity vv =head1 INHERITANCE Mail::Message::Convert::MimeEntity is a Mail::Message::Convert is a Mail::Reporter =head1 SYNOPSIS use Mail::Message::Convert::MimeEntity; my $convert = Mail::Message::Convert::MimeEntity->new; my Mail::Message $msg = Mail::Message->new; my MIME::Entity $entity = $convert->export($msg); my MIME::Entity $entity = MIME::Entity->new; my Mail::Message $msg = $convert->from($entity); use Mail::Box::Manager; my $mgr = Mail::Box::Manager->new; my $folder = $mgr->open(folder => 'Outbox'); $folder->addMessage($entity); =head1 DESCRIPTION The MIME::Entity extends L<Mail::Internet|Mail::Internet> message with multiparts and more methods. The L<Mail::Message|Mail::Message> objects are more flexible in how the message parts are stored, and uses separate header and body objects. Extends L<"DESCRIPTION" in Mail::Message::Convert|Mail::Message::Convert/"DESCRIPTION">. =head1 METHODS Extends L<"METHODS" in Mail::Message::Convert|Mail::Message::Convert/"METHODS">. =head2 Constructors Extends L<"Constructors" in Mail::Message::Convert|Mail::Message::Convert/"Constructors">. =over 4 =item $class-E<gt>B<new>(%options) Inherited, see L<Mail::Message::Convert/"METHODS"> =back =head2 Attributes Extends L<"Attributes" in Mail::Message::Convert|Mail::Message::Convert/"Attributes">. =head2 Converting Extends L<"Converting" in Mail::Message::Convert|Mail::Message::Convert/"Converting">. =over 4 =item $obj-E<gt>B<export>( $message, [$parser] ) Returns a new MIME::Entity message object based on the information from the C<$message>, which is a L<Mail::Message|Mail::Message> object. You may want to supply your own C<$parser>, which is a MIME::Parser object, to change the parser flags. Without a C<$parser> object, one is created for you, with all the default settings. If C<undef> is passed, in place of a C<$message>, then an empty list is returned. When the parsing failes, then MIME::Parser throws an exception. » example: my $convert = Mail::Message::Convert::MimeEntity->new; my Mail::Message $msg = Mail::Message->new; my MIME::Entity $copy = $convert->export($msg); =item $obj-E<gt>B<from>($mime_object) Returns a new L<Mail::Message|Mail::Message> object based on the information from the specified MIME::Entity. If the conversion fails, the C<undef> is returned. If C<undef> is passed in place of an OBJECT, then an empty list is returned. » example: my $convert = Mail::Message::Convert::MimeEntity->new; my MIME::Entity $msg = MIME::Entity->new; my Mail::Message $copy = $convert->from($msg); =item $obj-E<gt>B<selectedFields>($head) Inherited, see L<Mail::Message::Convert/"Converting"> =back =head2 Error handling Extends L<"Error handling" in Mail::Message::Convert|Mail::Message::Convert/"Error handling">. =over 4 =item $obj-E<gt>B<AUTOLOAD>() Inherited, see L<Mail::Reporter/"Error handling"> =item $obj-E<gt>B<notImplemented>() Inherited, see L<Mail::Reporter/"Error handling"> =back =head2 Cleanup Extends L<"Cleanup" in Mail::Message::Convert|Mail::Message::Convert/"Cleanup">. =over 4 =item $obj-E<gt>B<DESTROY>() Inherited, see L<Mail::Reporter/"Cleanup"> =back =head1 DIAGNOSTICS =over 4 =item Error: class $package does not implement method $method. Fatal error: the specific C<$package> (or one of its superclasses) does not implement this method where it should. This message means that some other related classes do implement this method however the class at hand does not. Probably you should investigate this and probably inform the author of the package. Cast by C<notImplemented()> =item Error: converting from MIME::Entity but got a $class. Cast by C<from()> =item Error: export message must be a Mail::Message object, but is $what. Cast by C<export()> =back =head1 SEE ALSO This module is part of Mail-Message version 4.02, built on January 22, 2026. Website: F<http://perl.overmeer.net/CPAN/> =head1 LICENSE For contributors see file ChangeLog. This software is copyright (c) 2001-2026 by Mark Overmeer. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Mail-Message-4.02/lib/Mail/Message/Convert/TextAutoformat.pod���������������������������������������0000644�0001750�0000144�00000006107�15134356602�024560� 0����������������������������������������������������������������������������������������������������ustar�00markov��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������=encoding utf8 =head1 NAME Mail::Message::Convert::TextAutoformat - Reformat plain text messages =head1 INHERITANCE Mail::Message::Convert::TextAutoformat is a Mail::Message::Convert is a Mail::Reporter =head1 SYNOPSIS use Mail::Message::Convert::TextAutoformat; my $af = Mail::Message::Convert::TextAutoformat->new; my $beautified_body = $af->autoformatBody($body); =head1 DESCRIPTION Play trics with plain text, for instance bodies with type C<text/plain> using Damian Conway's Text::Autoformat. Extends L<"DESCRIPTION" in Mail::Message::Convert|Mail::Message::Convert/"DESCRIPTION">. =head1 METHODS Extends L<"METHODS" in Mail::Message::Convert|Mail::Message::Convert/"METHODS">. =head2 Constructors Extends L<"Constructors" in Mail::Message::Convert|Mail::Message::Convert/"Constructors">. =over 4 =item $class-E<gt>B<new>(%options) Inherited, see L<Mail::Reporter/"Constructors"> -Option --Defined in --Default fields Mail::Message::Convert <see description> options +{ all => 1 } =over 2 =item fields => $name|$regex|\@names|\@regexes =item options => \%af The C<%af> options to pass to Text::Autoformat function C<autoformat()>. =back =back =head2 Attributes Extends L<"Attributes" in Mail::Message::Convert|Mail::Message::Convert/"Attributes">. =head2 Converting Extends L<"Converting" in Mail::Message::Convert|Mail::Message::Convert/"Converting">. =over 4 =item $obj-E<gt>B<autoformatBody>($body) Formats a single message body (a L<Mail::Message::Body|Mail::Message::Body> object) into a new body object using Text::Autoformat. The body should have content type C<text/plain>, otherwise the output is probably weird. =item $obj-E<gt>B<selectedFields>($head) Inherited, see L<Mail::Message::Convert/"Converting"> =back =head2 Error handling Extends L<"Error handling" in Mail::Message::Convert|Mail::Message::Convert/"Error handling">. =over 4 =item $obj-E<gt>B<AUTOLOAD>() Inherited, see L<Mail::Reporter/"Error handling"> =item $obj-E<gt>B<notImplemented>() Inherited, see L<Mail::Reporter/"Error handling"> =back =head2 Cleanup Extends L<"Cleanup" in Mail::Message::Convert|Mail::Message::Convert/"Cleanup">. =over 4 =item $obj-E<gt>B<DESTROY>() Inherited, see L<Mail::Reporter/"Cleanup"> =back =head1 DIAGNOSTICS =over 4 =item Error: class $package does not implement method $method. Fatal error: the specific C<$package> (or one of its superclasses) does not implement this method where it should. This message means that some other related classes do implement this method however the class at hand does not. Probably you should investigate this and probably inform the author of the package. Cast by C<notImplemented()> =back =head1 SEE ALSO This module is part of Mail-Message version 4.02, built on January 22, 2026. Website: F<http://perl.overmeer.net/CPAN/> =head1 LICENSE For contributors see file ChangeLog. This software is copyright (c) 2001-2026 by Mark Overmeer. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Mail-Message-4.02/lib/Mail/Message/Convert/Html.pm��������������������������������������������������0000644�0001750�0000144�00000007261�15134356601�022331� 0����������������������������������������������������������������������������������������������������ustar�00markov��������������������������users���������������������������0000000�0000000������������������������������������������������������������������������������������������������������������������������������������������������������������������������# This code is part of Perl distribution Mail-Message version 4.02. # The POD got stripped from this file by OODoc version 3.06. # For contributors see file ChangeLog. # This software is copyright (c) 2001-2026 by Mark Overmeer. # This is free software; you can redistribute it and/or modify it under # the same terms as the Perl 5 programming language system itself. # SPDX-License-Identifier: Artistic-1.0-Perl OR GPL-1.0-or-later package Mail::Message::Convert::Html;{ our $VERSION = '4.02'; } use parent 'Mail::Message::Convert'; use strict; use warnings; use Log::Report 'mail-message', import => [ qw/__x error/ ]; #-------------------- sub init($) { my ($self, $args) = @_; $self->SUPER::init($args); my $produce = $args->{produce} || 'HTML'; $self->{MMCH_tail} = $produce eq 'HTML' ? '>' : $produce eq 'XHTML' ? ' />' : error __x"produce XHTML or HTML, not {what UNKNOWN}.", what => $produce; $self; } #-------------------- sub textToHtml(@) { my $self = shift; my @lines = @_; # copy is required foreach (@lines) { s/\&/&/gs; s/\</</gs; s/\>/>/gs; s/\"/"/gs; } wantarray ? @lines : join('', @lines); } sub fieldToHtml($;$) { my ($self, $field, $subject) = @_; '<strong>'. $self->textToHtml($field->wellformedName) . ': </strong>' . $self->fieldContentsToHtml($field, $subject); } sub headToHtmlTable($;$) { my ($self, $head) = (shift, shift); my $tp = @_ ? ' '.shift : ''; my $subject; if($self->{MMHC_mailto_subject}) { my $s = $head->get('subject'); use Mail::Message::Construct; $subject = Mail::Message::Construct->replySubject($s) if defined $s; } my @lines = "<table $tp>\n"; foreach my $f ($self->selectedFields($head)) { my $name_html = $self->textToHtml($f->wellformedName); my $cont_html = $self->fieldContentsToHtml($f, $subject); push @lines, qq(<tr><th valign="top" align="left">$name_html:</th>\n), qq( <td valign="top">$cont_html</td></tr>\n); } push @lines, "</table>\n"; wantarray ? @lines : join('',@lines); } sub headToHtmlHead($@) { my ($self, $head) = (shift,shift); my %meta; while(@_) { my $k = shift; $meta{lc $k} = shift } my $title = delete $meta{title} || $head->get('subject') || '<no subject>'; my @lines = ( "<head>\n", "<title>".$self->textToHtml($title) . "\n", ); my $author = delete $meta{author}; unless(defined $author) { my $from = $head->get('from'); my @addr = defined $from ? $from->addresses : (); $author = @addr ? $addr[0]->format : undef; } push @lines, '{MMCH_tail}\n" if defined $author; foreach my $f (map {lc} keys %meta) { next if $meta{$f} eq ''; # empty is skipped. push @lines, '{MMCH_tail}\n"; } foreach my $f ($self->selectedFields($head)) { next if exists $meta{$f->name}; push @lines, '{MMCH_tail}\n"; } push @lines, "\n"; wantarray ? @lines : join('',@lines); } my $atom = qr/[^()<>@,;:\\".\[\]\s[:cntrl:]]+/; my $email_address = qr/(($atom(?:\.$atom)*)\@($atom(?:\.$atom)+))/o; sub fieldContentsToHtml($;$) { my ($self, $field, $subj) = @_; my $subject = defined $subj ? '?subject='.$self->textToHtml($subj) : ''; my $body = $self->textToHtml($field->body); my $comment = $field->comment; $body =~ s#$email_address#$1#gx if $field->name =~ m/^(resent-)?(to|from|cc|bcc|reply\-to)$/; $body . ($comment ? '; '.$self->textToHtml($comment) : ''); } 1; Mail-Message-4.02/lib/Mail/Message/Convert/MailInternet.pod0000644000175000001440000000764415134356602024174 0ustar00markovusers00000000000000=encoding utf8 =head1 NAME Mail::Message::Convert::MailInternet - translate Mail::Message to Mail::Internet vv =head1 INHERITANCE Mail::Message::Convert::MailInternet is a Mail::Message::Convert is a Mail::Reporter =head1 SYNOPSIS use Mail::Message::Convert::MailInternet; my $convert = Mail::Message::Convert::MailInternet->new; my Mail::Message $msg = Mail::Message->new; my Mail::Internet $intern = $convert->export($msg); my Mail::Internet $intern = Mail::Internet->new; my Mail::Message $msg = $convert->from($intern); use Mail::Box::Manager; my $mgr = Mail::Box::Manager->new; my $folder = $mgr->open(folder => 'Outbox'); $folder->addMessage($intern); =head1 DESCRIPTION The L class of messages is very popular for all kinds of message applications written in Perl. However, the format was developed when e-mail messages where still small and attachments where rare; L is much more flexible in this respect. Extends L<"DESCRIPTION" in Mail::Message::Convert|Mail::Message::Convert/"DESCRIPTION">. =head1 METHODS Extends L<"METHODS" in Mail::Message::Convert|Mail::Message::Convert/"METHODS">. =head2 Constructors Extends L<"Constructors" in Mail::Message::Convert|Mail::Message::Convert/"Constructors">. =over 4 =item $class-EB(%options) Inherited, see L =back =head2 Attributes Extends L<"Attributes" in Mail::Message::Convert|Mail::Message::Convert/"Attributes">. =head2 Converting Extends L<"Converting" in Mail::Message::Convert|Mail::Message::Convert/"Converting">. =over 4 =item $obj-EB($message, %options) Returns a new message object based on the information from a L object. The C<$message> specified is an instance of a L. » example: my $convert = Mail::Message::Convert::MailInternet->new; my Mail::Message $msg = Mail::Message->new; my Mail::Internet $copy = $convert->export($msg); =item $obj-EB($object, %options) Returns a new L object based on the information from a L object. » example: my $convert = Mail::Message::Convert::MailInternet->new; my Mail::Internet $msg = Mail::Internet->new; my Mail::Message $copy = $convert->from($msg); =item $obj-EB($head) Inherited, see L =back =head2 Error handling Extends L<"Error handling" in Mail::Message::Convert|Mail::Message::Convert/"Error handling">. =over 4 =item $obj-EB() Inherited, see L =item $obj-EB() Inherited, see L =back =head2 Cleanup Extends L<"Cleanup" in Mail::Message::Convert|Mail::Message::Convert/"Cleanup">. =over 4 =item $obj-EB() Inherited, see L =back =head1 DIAGNOSTICS =over 4 =item Error: class $package does not implement method $method. Fatal error: the specific C<$package> (or one of its superclasses) does not implement this method where it should. This message means that some other related classes do implement this method however the class at hand does not. Probably you should investigate this and probably inform the author of the package. Cast by C =item Error: converting from Mail::Internet but got a $what. Cast by C =item Error: export message must be a Mail::Message object, but is $what. Cast by C =back =head1 SEE ALSO This module is part of Mail-Message version 4.02, built on January 22, 2026. Website: F =head1 LICENSE For contributors see file ChangeLog. This software is copyright (c) 2001-2026 by Mark Overmeer. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. Mail-Message-4.02/lib/Mail/Message/Convert/HtmlFormatText.pm0000644000175000001440000000244415134356601024345 0ustar00markovusers00000000000000# This code is part of Perl distribution Mail-Message version 4.02. # The POD got stripped from this file by OODoc version 3.06. # For contributors see file ChangeLog. # This software is copyright (c) 2001-2026 by Mark Overmeer. # This is free software; you can redistribute it and/or modify it under # the same terms as the Perl 5 programming language system itself. # SPDX-License-Identifier: Artistic-1.0-Perl OR GPL-1.0-or-later package Mail::Message::Convert::HtmlFormatText;{ our $VERSION = '4.02'; } use parent 'Mail::Message::Convert'; use strict; use warnings; use Log::Report 'mail-message', import => [ qw// ]; use HTML::TreeBuilder (); use HTML::FormatText (); use Mail::Message::Body::String (); #-------------------- sub init($) { my ($self, $args) = @_; $self->SUPER::init($args); $self->{MMCH_formatter} = HTML::FormatText->new( leftmargin => $args->{leftmargin} // 3,, rightmargin => $args->{rightmargin} // 72, ); $self; } #-------------------- sub format($) { my ($self, $body) = @_; my $dec = $body->encode(transfer_encoding => 'none'); my $tree = HTML::TreeBuilder->new_from_file($dec->file); (ref $body)->new( based_on => $body, mime_type => 'text/plain', charset => 'iso-8859-1', data => [ $self->{MMCH_formatter}->format($tree) ], ); } 1; Mail-Message-4.02/lib/Mail/Message/Head/0000755000175000001440000000000015134356615020307 5ustar00markovusers00000000000000Mail-Message-4.02/lib/Mail/Message/Head/SpamGroup.pod0000644000175000001440000001770015134356602022731 0ustar00markovusers00000000000000=encoding utf8 =head1 NAME Mail::Message::Head::SpamGroup - spam fighting related header fields =head1 INHERITANCE Mail::Message::Head::SpamGroup is a Mail::Message::Head::FieldGroup is a Mail::Reporter =head1 SYNOPSIS my $sg = Mail::Message::Head::SpamGroup->new(head => $head, ...); $head->addSpamGroup($sg); my $sg = $head->addSpamGroup( ); $sg->delete; my @sgs = $head->spamGroups; =head1 DESCRIPTION A I is a set of header fields which are added by spam detection and spam fighting software. This class knows various details about that software. Extends L<"DESCRIPTION" in Mail::Message::Head::FieldGroup|Mail::Message::Head::FieldGroup/"DESCRIPTION">. =head1 METHODS Extends L<"METHODS" in Mail::Message::Head::FieldGroup|Mail::Message::Head::FieldGroup/"METHODS">. =head2 Constructors Extends L<"Constructors" in Mail::Message::Head::FieldGroup|Mail::Message::Head::FieldGroup/"Constructors">. =over 4 =item $obj-EB() Inherited, see L =item $any-EB($name, %options) Get the settings of a certain spam-fighter, optionally after setting them. The L method returns the defined names. The names are case-sensitive. The C<%options> are all passed as settings to the spamfilter, except the few which are listed here specifically. -Option --Default fields isspam version undef =over 2 =item fields => REGEXP The regular expression which indicates which of the header fields are added by the spam fighter software. =item isspam => CODE The CODE must return C or C, to indicate whether the spam fighter thinks that the message contains spam. The CODE ref is called with the spamgroup object (under construction) and the header which is inspected. =item version => CODE Can be called to collect the official name and the version of the software which is used to detect spam. The CODE ref is called with the spamgroup object (under construction) and the header which is inspected. =back » example: adding your own spam-fighter definitions Mail::Message::Head::SpamGroup->fighter( 'MY-OWN', fields => qw/^x-MY-SPAM-DETECTOR-/, isspam => sub { my ($sg, $head) = @_; $head->fields > 100 }, ); =item $obj-EB($head|$message, %options) Returns a list of C objects, based on the specified C<$message> or message C<$head>. Improves base, see L -Option--Default types undef =over 2 =item types => ARRAY-OF-NAMES Only the specified types will be tried. If the ARRAY is empty, an empty list is returned. Without this option, all sets are returned. =back =item $any-EB( [$message|$head] ) Returns a C value if the C<$message> or C<$head> contains C fields which are correct. Without argument, this is used as instance method on an existing Spam-Group. » example: checking Habeas-SWE fields if(Mail::Message::Head::SpamGroup->habeasSweFieldsCorrect($message)) { $message->label(spam => 0); } my $sg = $message->head->spamGroups('Habeas-SWE'); if($sg->habeasSweFieldsCorrect) { ... }; use List::Util 'first'; if(first {$_->habeasSweFieldsCorrect} $head->spamGroups) { ... } =item $any-EB() Inherited, see L =item $any-EB($name) Z<> =item $any-EB() Returns an unsorted list of all names representing pre-defined spam-fighter software. You can ask details about them, and register more fighters with the L method. =item $class-EB($fields, %options) Construct an object which maintains one set of fields which were added by spam fighting software. Improves base, see L -Option --Defined in --Default head Mail::Message::Head::FieldGroup undef software Mail::Message::Head::FieldGroup undef type Mail::Message::Head::FieldGroup undef version Mail::Message::Head::FieldGroup undef =over 2 =item head => $head =item software => STRING =item type => STRING =item version => STRING =back =item $obj-EB( [BOOLEAN] ) Returns (after setting) whether this group of spam headers thinks that this is spam. See L. » example: die if $head->spamDetected; foreach my $sg ($head->spamGroups) { print $sg->type." found spam\n" if $sg->spamDetected; } =back =head2 Attributes Extends L<"Attributes" in Mail::Message::Head::FieldGroup|Mail::Message::Head::FieldGroup/"Attributes">. =head2 The header Extends L<"The header" in Mail::Message::Head::FieldGroup|Mail::Message::Head::FieldGroup/"The header">. =over 4 =item $obj-EB( <$field, $value> | $object ) Inherited, see L =item $obj-EB( [$fieldnames] ) Inherited, see L =item $obj-EB($head) Inherited, see L =item $obj-EB() Inherited, see L =item $obj-EB() Inherited, see L =item $obj-EB() Inherited, see L =item $obj-EB() Inherited, see L =back =head2 Access to the header Extends L<"Access to the header" in Mail::Message::Head::FieldGroup|Mail::Message::Head::FieldGroup/"Access to the header">. =over 4 =item $obj-EB() Inherited, see L =item $obj-EB() Inherited, see L =item $obj-EB() Inherited, see L =back =head2 Internals Extends L<"Internals" in Mail::Message::Head::FieldGroup|Mail::Message::Head::FieldGroup/"Internals">. =over 4 =item $obj-EB( [$name] ) Inherited, see L =item $obj-EB($type, $software, $version) Inherited, see L =back =head2 Error handling Extends L<"Error handling" in Mail::Message::Head::FieldGroup|Mail::Message::Head::FieldGroup/"Error handling">. =over 4 =item $obj-EB() Inherited, see L =item $obj-EB
() Inherited, see L =item $obj-EB() Inherited, see L =item $obj-EB( [$fh] ) Inherited, see L =back =head2 Cleanup Extends L<"Cleanup" in Mail::Message::Head::FieldGroup|Mail::Message::Head::FieldGroup/"Cleanup">. =over 4 =item $obj-EB() Inherited, see L =back =head1 DIAGNOSTICS =over 4 =item Error: class $package does not implement method $method. Fatal error: the specific C<$package> (or one of its superclasses) does not implement this method where it should. This message means that some other related classes do implement this method however the class at hand does not. Probably you should investigate this and probably inform the author of the package. Cast by C =back =head1 SEE ALSO This module is part of Mail-Message version 4.02, built on January 22, 2026. Website: F =head1 LICENSE For contributors see file ChangeLog. This software is copyright (c) 2001-2026 by Mark Overmeer. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. Mail-Message-4.02/lib/Mail/Message/Head/SpamGroup.pm0000644000175000001440000000756615134356601022573 0ustar00markovusers00000000000000# This code is part of Perl distribution Mail-Message version 4.02. # The POD got stripped from this file by OODoc version 3.06. # For contributors see file ChangeLog. # This software is copyright (c) 2001-2026 by Mark Overmeer. # This is free software; you can redistribute it and/or modify it under # the same terms as the Perl 5 programming language system itself. # SPDX-License-Identifier: Artistic-1.0-Perl OR GPL-1.0-or-later package Mail::Message::Head::SpamGroup;{ our $VERSION = '4.02'; } use parent 'Mail::Message::Head::FieldGroup'; use strict; use warnings; use Log::Report 'mail-message', import => [ qw/panic/ ]; #-------------------- my %fighters; my $fighterfields; # one regexp for all fields sub knownFighters() { keys %fighters } sub fighter($;@) { my ($thing, $name) = (shift, shift); if(@_) { my %args = @_; defined $args{fields} or panic "requires fields"; defined $args{isspam} or panic "requires isspam"; $fighters{$name} = \%args; my @fields = map $_->{fields}, values %fighters; local $" = '|'; $fighterfields = qr/@fields/; } %{$fighters{$name}}; } BEGIN { __PACKAGE__->fighter( SpamAssassin => fields => qr/^X-Spam-/i, isspam => sub { my ($sg, $head) = @_; my $f = $head->get('X-Spam-Flag') || $head->get('X-Spam-Status'); $f ? $f =~ m/^yes\b/i : 0; }, version => sub { my ($sg, $head) = @_; my $assin = $head->get('X-Spam-Checker-Version') or return (); my ($software, $version) = $assin =~ m/^(.*)\s+(.*?)\s*$/; ($software, $version); }, ); __PACKAGE__->fighter( 'Habeas-SWE' => fields => qr/^X-Habeas-SWE/i, isspam => sub { my ($sg, $head) = @_; not $sg->habeasSweFieldsCorrect; }, ); __PACKAGE__->fighter( MailScanner => fields => qr/^X-MailScanner/i, isspam => sub { my ($sg, $head) = @_; my $subject = $head->get('subject'); $subject =~ m/^\{ (?:spam|virus)/xi; }, ); } sub from($@) { my ($class, $from, %args) = @_; my $head = $from->isa('Mail::Message::Head') ? $from : $from->head; my ($self, @detected); my @types = defined $args{types} ? @{$args{types}} : $class->knownFighters; foreach my $type (@types) { $self = $class->new(head => $head) unless defined $self; $self->collectFields($type) or next; my %fighter = $self->fighter($type); my ($software, $version) = defined $fighter{version} ? $fighter{version}->($self, $head) : (); $self->detected($type, $software, $version); $self->spamDetected( $fighter{isspam}->($self, $head) ); push @detected, $self; undef $self; # create a new one } @detected; } sub collectFields($) { my ($self, $set) = @_; my %fighter = $self->fighter($set) or panic "no spam set $set"; my @names = map $_->name, $self->head->grepNames($fighter{fields}); $self->addFields(@names) if @names; @names; } sub isSpamGroupFieldName($) { $_[1] =~ $fighterfields } my @habeas_lines = ( 'winter into spring', 'brightly anticipated', 'like Habeas SWE (tm)', 'Copyright 2002 Habeas (tm)', 'Sender Warranted Email (SWE) (tm). The sender of this', 'email in exchange for a license for this Habeas', 'warrant mark warrants that this is a Habeas Compliant', 'Message (HCM) and not spam. Please report use of this', 'mark in spam to .', ); sub habeasSweFieldsCorrect(;$) { my $self; if(@_ > 1) { my ($class, $thing) = @_; my $head = $thing->isa('Mail::Message::Head') ? $thing : $thing->head; $self = $head->spamGroups('Habeas-SWE') or return; } else { $self = shift; my $type = $self->type; defined $type && $type eq 'Habeas-SWE' or return; } my $head = $self->head; $self->fields == @habeas_lines or return; for(my $nr=1; $nr <= $#habeas_lines; $nr++) { my $f = $head->get("X-Habeas-SWE-$nr") or return; $f->unfoldedBody eq $habeas_lines[$nr-1] or return; } 1; } sub spamDetected(;$) { my $self = shift; @_? ($self->{MMFS_spam} = shift) : $self->{MMFS_spam}; } 1; Mail-Message-4.02/lib/Mail/Message/Head/ResentGroup.pm0000644000175000001440000001116415134356601023120 0ustar00markovusers00000000000000# This code is part of Perl distribution Mail-Message version 4.02. # The POD got stripped from this file by OODoc version 3.06. # For contributors see file ChangeLog. # This software is copyright (c) 2001-2026 by Mark Overmeer. # This is free software; you can redistribute it and/or modify it under # the same terms as the Perl 5 programming language system itself. # SPDX-License-Identifier: Artistic-1.0-Perl OR GPL-1.0-or-later package Mail::Message::Head::ResentGroup;{ our $VERSION = '4.02'; } use parent 'Mail::Message::Head::FieldGroup'; use strict; use warnings; use Log::Report 'mail-message', import => [ qw// ]; use Scalar::Util qw/weaken/; use Sys::Hostname qw/hostname/; use Mail::Address (); use Mail::Message::Field::Fast (); #-------------------- # all lower cased! my @ordered_field_names = ( 'return-path', 'delivered-to' , 'received', 'resent-date', 'resent-from', 'resent-sender', , 'resent-to', 'resent-cc', 'resent-bcc', 'resent-message-id' ); my %resent_field_names = map +($_ => 1), @ordered_field_names; sub init($$) { my ($self, $args) = @_; $self->SUPER::init($args); $self->{MMHR_real} = $args->{message_head}; $self->set(Received => $self->createReceived) if $self->orderedFields && ! $self->received; $self; } sub from($@) { @_==1 and return $_[0]->resentFrom; # backwards compat my ($class, $from, %args) = @_; my $head = $from->isa('Mail::Message::Head') ? $from : $from->head; my (@groups, $group, $return_path, $delivered_to); foreach my $field ($head->orderedFields) { my $name = $field->name; $resent_field_names{$name} or next; if($name eq 'return-path') { $return_path = $field } elsif($name eq 'delivered-to') { $delivered_to = $field } elsif(substr($name, 0, 7) eq 'resent-') { $group->add($field) if defined $group; } elsif($name eq 'received') { $group = Mail::Message::Head::ResentGroup ->new($field, message_head => $head); push @groups, $group; $group->add($delivered_to) if defined $delivered_to; undef $delivered_to; $group->add($return_path) if defined $return_path; undef $return_path; } } @groups; } #-------------------- sub messageHead(;$) { my $self = shift; @_ ? $self->{MMHR_real} = shift : $self->{MMHR_real}; } sub orderedFields() { my $head = shift->head; map { $head->get($_) || () } @ordered_field_names; } sub set($;$) { my $self = shift; my $field; if(@_==1) { $field = shift } else { my ($fn, $value) = @_; my $name = $resent_field_names{lc $fn} ? $fn : "Resent-$fn"; $field = Mail::Message::Field::Fast->new($name, $value); } $self->head->set($field); $field; } sub fields() { $_[0]->orderedFields } sub fieldNames() { map $_->Name, $_[0]->orderedFields } sub delete() { my $self = shift; my $head = $self->messageHead; $head->removeField($_) for $self->fields; $self; } sub add(@) { shift->set(@_) } sub addFields(@) { $_[0]->notImplemented } #-------------------- sub returnPath() { $_[0]->{MMHR_return_path} } sub deliveredTo() { $_[0]->head->get('Delivered-To') } sub received() { $_[0]->head->get('Received') } sub receivedTimestamp() { my $received = $_[0]->received or return; my $comment = $received->comment or return; Mail::Message::Field->dateToTimestamp($comment); } sub date($) { $_[0]->head->get('resent-date') } sub dateTimestamp() { my $date = $_[0]->date or return; Mail::Message::Field->dateToTimestamp($date->unfoldedBody); } sub resentFrom() { my $from = $_[0]->head->get('resent-from') or return (); wantarray ? $from->addresses : $from; } sub sender() { my $sender = $_[0]->head->get('resent-sender') or return (); wantarray ? $sender->addresses : $sender; } sub to() { my $to = $_[0]->head->get('resent-to') or return (); wantarray ? $to->addresses : $to; } sub cc() { my $cc = $_[0]->head->get('resent-cc') or return (); wantarray ? $cc->addresses : $cc; } sub bcc() { my $bcc = $_[0]->head->get('resent-bcc') or return (); wantarray ? $bcc->addresses : $bcc; } sub destinations() { my $self = shift; ($self->to, $self->cc, $self->bcc); } sub messageId() { $_[0]->head->get('resent-message-id') } sub isResentGroupFieldName($) { $resent_field_names{lc $_[1]} } #-------------------- my $unique_received_id = 'rc'.time; sub createReceived(;$) { my ($self, $domain) = @_; unless(defined $domain) { my $sender = ($self->sender)[0] || ($self->resentFrom)[0]; $domain = $sender->host if defined $sender; } my $received = "from $domain by ". hostname . ' with SMTP id ' . $unique_received_id++ . ' for ' . $self->head->get('Resent-To') # may be wrong . '; '. Mail::Message::Field->toDate; $received; } #-------------------- 1; Mail-Message-4.02/lib/Mail/Message/Head/FieldGroup.pm0000644000175000001440000000616615134356601022711 0ustar00markovusers00000000000000# This code is part of Perl distribution Mail-Message version 4.02. # The POD got stripped from this file by OODoc version 3.06. # For contributors see file ChangeLog. # This software is copyright (c) 2001-2026 by Mark Overmeer. # This is free software; you can redistribute it and/or modify it under # the same terms as the Perl 5 programming language system itself. # SPDX-License-Identifier: Artistic-1.0-Perl OR GPL-1.0-or-later package Mail::Message::Head::FieldGroup;{ our $VERSION = '4.02'; } use parent 'Mail::Reporter'; use strict; use warnings; use Log::Report 'mail-message', import => [ qw/trace/ ]; use Scalar::Util qw/blessed/; #-------------------- sub new(@) { my $class = shift; my @fields; push @fields, shift while blessed $_[0]; $class->SUPER::new(@_, fields => \@fields); } sub init($$) { my ($self, $args) = @_; $self->SUPER::init($args); my $head = $self->{MMHF_head} = $args->{head} || Mail::Message::Head::Partial->new; $self->add($_) # add specified object fields for @{$args->{fields}}; $self->add($_, delete $args->{$_}) # add key-value paired fields for grep m/^[A-Z]/, keys %$args; $self->{MMHF_version} = $args->{version} if defined $args->{version}; $self->{MMHF_software} = $args->{software} if defined $args->{software}; $self->{MMHF_type} = $args->{type} if defined $args->{type}; $self->{MMHF_fns} = []; $self; } sub implementedTypes() { $_[0]->notImplemented } sub from($) { $_[0]->notImplemented } sub clone() { my $self = shift; my $clone = bless %$self, ref $self; $clone->{MMHF_fns} = [ $self->fieldNames ]; $clone; } #-------------------- sub head() { $_[0]->{MMHF_head} } sub attach($) { my ($self, $head) = @_; $head->add($_->clone) for $self->fields; $self; } sub delete() { my $self = shift; my $head = $self->head; $head->removeField($_) for $self->fields; $self; } sub add(@) { my $self = shift; my $field = $self->head->add(@_) or return (); push @{$self->{MMHF_fns}}, $field->name; $self; } sub fields() { my $self = shift; my $head = $self->head; map $head->get($_), $self->fieldNames; } sub fieldNames() { @{ $_[0]->{MMHF_fns}} } sub addFields(@) { my $self = shift; my $head = $self->head; push @{$self->{MMHF_fns}}, @_; @_; } #-------------------- sub version() { $_[0]->{MMHF_version} } sub software() { $_[0]->{MMHF_software} } sub type() { $_[0]->{MMHF_type} } #-------------------- sub detected($$$) { my $self = shift; @$self{ qw/MMHF_type MMHF_software MMHF_version/ } = @_; } sub collectFields(;$) { $_[0]->notImplemented } #-------------------- sub print(;$) { my $self = shift; my $out = shift || select; $_->print($out) for $self->fields; } sub details() { my $self = shift; my $type = $self->type || 'Unknown'; my $software = $self->software; undef $software if defined($software) && $type eq $software; my $version = $self->version; my $release = defined $software ? (defined $version ? " ($software $version)" : " ($software)") : (defined $version ? " ($version)" : ''); my $fields = scalar $self->fields; "$type $release, $fields fields"; } 1; Mail-Message-4.02/lib/Mail/Message/Head/Partial.pm0000644000175000001440000000500615134356601022235 0ustar00markovusers00000000000000# This code is part of Perl distribution Mail-Message version 4.02. # The POD got stripped from this file by OODoc version 3.06. # For contributors see file ChangeLog. # This software is copyright (c) 2001-2026 by Mark Overmeer. # This is free software; you can redistribute it and/or modify it under # the same terms as the Perl 5 programming language system itself. # SPDX-License-Identifier: Artistic-1.0-Perl OR GPL-1.0-or-later package Mail::Message::Head::Partial;{ our $VERSION = '4.02'; } use parent 'Mail::Message::Head::Complete'; use strict; use warnings; use Log::Report 'mail-message', import => [ qw// ]; use Scalar::Util qw/weaken/; #-------------------- sub removeFields(@) { my $self = shift; my $known = $self->{MMH_fields}; foreach my $match (@_) { if(ref $match) { $_ =~ $match && delete $known->{$_} for keys %$known } else { delete $known->{lc $match} } } $self->cleanupOrderedFields; } sub removeFieldsExcept(@) { my $self = shift; my $known = $self->{MMH_fields}; my %remove = map +($_ => 1), keys %$known; foreach my $match (@_) { if(ref $match) { $_ =~ $match && delete $remove{$_} for keys %remove } else { delete $remove{lc $match} } } delete @$known{ keys %remove }; $self->cleanupOrderedFields; } sub removeResentGroups() { my $self = shift; require Mail::Message::Head::ResentGroup; my $known = $self->{MMH_fields}; my $found = 0; foreach my $name (keys %$known) { Mail::Message::Head::ResentGroup->isResentGroupFieldName($name) or next; delete $known->{$name}; $found++; } $self->cleanupOrderedFields; $self->modified(1) if $found; $found; } sub removeListGroup() { my $self = shift; require Mail::Message::Head::ListGroup; my $known = $self->{MMH_fields}; my $found = 0; foreach my $name (keys %$known) { Mail::Message::Head::ListGroup->isListGroupFieldName($name) or next; delete $known->{$name}; $found++; } $self->cleanupOrderedFields if $found; $self->modified(1) if $found; $found; } sub removeSpamGroups() { my $self = shift; require Mail::Message::Head::SpamGroup; my $known = $self->{MMH_fields}; my $found = 0; foreach my $name (keys %$known) { Mail::Message::Head::SpamGroup->isSpamGroupFieldName($name) or next; delete $known->{$name}; $found++; } $self->cleanupOrderedFields if $found; $self->modified(1) if $found; $found; } sub cleanupOrderedFields() { my $self = shift; my @take = grep defined, @{$self->{MMH_order}}; weaken($_) for @take; $self->{MMH_order} = \@take; $self; } #-------------------- 1; Mail-Message-4.02/lib/Mail/Message/Head/Complete.pod0000644000175000001440000006062115134356602022564 0ustar00markovusers00000000000000=encoding utf8 =head1 NAME Mail::Message::Head::Complete - the header of one message =head1 INHERITANCE Mail::Message::Head::Complete is a Mail::Message::Head is a Mail::Reporter Mail::Message::Head::Complete is extended by Mail::Message::Head::Partial Mail::Message::Replace::MailHeader Mail::Message::Head::Complete is realized by Mail::Message::Head::Delayed Mail::Message::Head::Subset =head1 SYNOPSIS my $head = Mail::Message::Head::Complete->new; See Mail::Message::Head =head1 DESCRIPTION Message headers can be in various states: unread, partially read, and fully read. This class represents a header of which all fields are known for sure: the complete set. Extends L<"DESCRIPTION" in Mail::Message::Head|Mail::Message::Head/"DESCRIPTION">. =head1 OVERLOADED Extends L<"OVERLOADED" in Mail::Message::Head|Mail::Message::Head/"OVERLOADED">. =over 4 =item overload: B<""> stringifaction Inherited, see L =item overload: B true/false Inherited, see L =back =head1 METHODS Extends L<"METHODS" in Mail::Message::Head|Mail::Message::Head/"METHODS">. =head2 Constructors Extends L<"Constructors" in Mail::Message::Head|Mail::Message::Head/"Constructors">. =over 4 =item $class-EB( [PAIR|$field], ... ) Undefined values are interpreted as empty field values, and therefore skipped. Improves base, see L =item $obj-EB( [@names|ARRAY|Regexps] ) Make a copy of the header, optionally limited only to the header lines specified by C<@names>. See L on the way these fields can be used. » example: my $newhead = $head->clone('Subject', 'Received'); =item $class-EB(%options) Inherited, see L =back =head2 Attributes Extends L<"Attributes" in Mail::Message::Head|Mail::Message::Head/"Attributes">. =head2 The header Extends L<"The header" in Mail::Message::Head|Mail::Message::Head/"The header">. =over 4 =item $obj-EB() Inherited, see L =item $obj-EB() Inherited, see L =item $obj-EB() Inherited, see L =item $obj-EB() Inherited, see L =item $obj-EB( [$message] ) Inherited, see L =item $obj-EB( [BOOLEAN] ) Inherited, see L =item $obj-EB() Return the number of lines needed to display this header (including the trailing newline) =item $obj-EB() Inherited, see L =item $obj-EB() Return the number of bytes needed to display this header (including the trailing newline). On systems which use CRLF as line separator, the number of lines in the header (see L) must be added to find the actual size in the file. =item $obj-EB($integer) Re-fold all fields from the header to contain at most C<$integer> number of characters per line. » example: re-folding a header $msg->head->wrap(78); =back =head2 Access to the header Extends L<"Access to the header" in Mail::Message::Head|Mail::Message::Head/"Access to the header">. =over 4 =item $obj-EB( $field | $line | <$name, $body, [$attrs]> ) Add a field to the header. If a field is added more than once, all values are stored in the header, in the order they are added. When a C<$field> object is specified (some L instance), that will be added. Another possibility is to specify a raw header C<$line>, or a header line nicely split-up in C<$name> and C<$body>, in which case the field constructor is called for you. C<$line> or C<$body> specifications which are terminated by a new-line are considered to be correctly folded. Lines which are not terminated by a new-line will be folded when needed: new-lines will be added where required. It is strongly advised to let MailBox do the folding for you. The return value of this method is the L object which is created (or was specified). » example: my $head = Mail::Message::Head->new; $head->add('Subject: hi!'); $head->add(From => 'me@home'); my $field = Mail::Message::Field->new('To: you@there'); $head->add($field); my Mail::Message::Field $s = $head->add(Sender => 'I'); =item $obj-EB($object) A I is a set of header fields which contain data about a mailing list which was used to transmit the message. See L for details about the implementation of the C<$object>. When you have a list group prepared, you can add it later using this method. You will get your private copy of the list group data in return, because the same group can be used for multiple messages. » example: of adding a list group to a header my $lg = Mail::Message::Head::ListGroup->new(...); my $own_lg = $msg->head->addListGroup($lg); =item $obj-EB($resent_group|$data) Add a C<$resent_group> (a L object) to the header. If you specify C<$data>, that is used to create such group first. If no C line is specified, it will be created for you. These header lines have nothing to do with the user's sense of C or C actions: these lines trace the e-mail transport mechanism. » example: my $rg = Mail::Message::Head::ResentGroup->new(head => $head, ...); $head->addResentGroup($rg); my $rg = $head->addResentGroup(From => 'me'); =item $obj-EB($object) A I is a set of header fields which contains data which is used to fight spam. See L for details about the implementation of the C<$object>. When you have a spam group prepared, you can add it later using this method. You will get your private copy of the spam group data in return, because the same group can be used for multiple messages. » example: of adding a spam group to a header my $sg = Mail::Message::Head::SpamGroup->new(...); my $own_sg = $msg->head->addSpamGroup($sg); =item $obj-EB($name) Count the number of fields with this C<$name>. Most fields will return 1: only one occurrence in the header. As example, the C fields are usually present more than once. =item $obj-EB($name) Remove the field with the specified name. If the header contained multiple lines with the same name, they will be replaced all together. This method simply calls L without replacement fields. READ THE IMPORTANT WARNING IN L =item $obj-EB( $name, [$index] ) Inherited, see L =item $obj-EB( [@names|ARRAY|Regexps] ) Filter from all header fields those with names which start will any of the specified list. When no names are specified, all fields will be returned. The list is ordered as they where read from file, or added later. The C<@names> are considered regular expressions, and will all be matched case insensitive and attached to the front of the string only. You may also specify one or more prepared regexes. » example: my @f = $head->grepNames(); # same as $head->orderedFields my @f = $head->grepNames('X-', 'Subject', '); my @to = $head->grepNames('To\b'); # will only select To =item $obj-EB() Returns a I description: the set of headers which form the information about mailing list software used to transport the message. See also L and L. » example: use of listGroup() if(my $lg = $msg->head->listGroup) { $lg->print(\*STDERR); $lg->delete; } $msg->head->removeListGroup; =item $obj-EB() Returns a full ordered list of known field names, as defined in the header. Fields which were reset() to be empty will still be listed here. =item $obj-EB( [$fh] ) Print all headers to the specified C<$fh>, by default the selected filehandle. See L to limit the headers to include only the public headers. » example: $head->print(\*OUT); $head->print; # to selected file open my ($fh), '>:raw', $filename; $head->print($fh); =item $obj-EB($fh, , ...) Like the usual L, the header lines are printed to the specified C<$fh>. In this case, however, only the fields with names as specified by C (case insensative) or Regexp are printed. They will stay the in-order of the source header. » example: printing only a subset of the fields $head->printSelected(STDOUT, qw/Subject From To/, qr/^x\-(spam|xyz)\-/i) =item $obj-EB( [$fh] ) Like the usual L, the header lines are printed to the specified C<$fh>, by default the selected filehandle. In this case, however, C and C lines are included. =item $obj-EB() Remove all body related fields from the header. The header will become partial. =item $obj-EB($field) Remove the specified C<$field> object from the header. This is useful when there are possible more than one fields with the same name, and you need to remove exactly one of them. Also have a look at L, L, and L. See also L (mind the 's' at the end of the name), which accepts a string or regular expression as argument to select the fields to be removed. WARNING WARNING WARNING: for performance reasons, the header administration uses weak references (see L method weaken()> to figure-out which fields have been removed. A header is a hash of field for fast search and an array of weak references to remember the order of the fields, required for printing. If the field is removed from the hash, the weak-ref is set to C and the field not printed. However... it is easy to disturb this process. Example: my $msg = ....; # subject ref-count = 1 + 0 = 1 $msg->head->delete('Subject'); # subject ref-count = 0 = 0: clean-up $msg->print; # subject doesn't show: ok But my $msg = ....; # subject ref-count = 1 + 0 = 1 my $s = $msg->head->get('subject'); # ref-count = 1 + 1 + 0 = 2 $msg->head->delete('Subject'); # subject ref-count = 1 + 0 = 1: no clean-up $msg->print; # subject DOES show: not ok undef $s; # ref-count becomes 0: clean-up $msg->print; # subject doesn't show: ok To avoid the latter situation, do not catch the field object, but only the field content. SAVE are all methods which return the text: my $s = $msg->head->get('subject')->body; my $s = $msg->head->get('subject')->unfoldedBody; my $s = $msg->head->get('subject')->foldedBody; my $s = $msg->head->get('subject')->foldedBody; my $s = $msg->get('subject'); my $s = $msg->subject; my $s = $msg->string; =item $obj-EB( , ... ) The header object is turned into a L object which has a set of fields removed. Read about the implications and the possibilities in L. =item $obj-EB( , ... ) The header object is turned into a L object which has a set of fields removed. Read about the implications and the possibilities in L. =item $obj-EB() Removes all fields related to mailing list administration at once. The header object is turned into a L object. Read about the implications and the possibilities in L. =item $obj-EB() Removes all resent groups at once. The header object is turned into a L object. Read about the implications and the possibilities in L. =item $obj-EB() Removes all fields which were added by various spam detection software at once. The header object is turned into a L object. Read about the implications and the possibilities in L. =item $obj-EB() Returns a list of L objects which each represent one intermediate point in the message's transmission in the order as they appear in the header: the most recent one first. See also L and L. A resent group contains a set of header fields whose names start with C. Before the first C line is I information, which is composed of an optional C field and an required C field. =item $obj-EB($name, @fields) Replace the values in the header fields named by C<$name> with the values specified in the list of C<@fields>. A single name can correspond to multiple repeated fields. READ THE IMPORTANT WARNING IN L Removing fields which are part of one of the predefined field groups is not a smart idea. You can better remove these fields as group, all together. For instance, the C<'Received'> lines are part of resent groups, C<'X-Spam'> is past of a spam group, and C belongs to a list group. You can delete a whole group with L, or with methods which are provided by L. If FIELDS is empty, the corresponding C<$name> fields will be removed. The location of removed fields in the header order will be remembered. Fields with the same name which are added later will appear at the remembered position. This is equivalent to the L method. » example: # reduce number of 'Keywords' lines to last 5) my @keywords = $head->get('Keywords'); $head->reset('Keywords', @keywords[-5..-1]) if @keywords > 5; # Reduce the number of Received lines to only the last added one. my @rgs = $head->resentGroups; shift @rgs; # keep this one (later is added in front) $_->delete foreach @rgs; =item $obj-EB( $field | $line | <$name, $body, [$attrs]> ) The C method is similar to the L method, and takes the same options. However, existing values for fields will be removed before a new value is added. READ THE IMPORTANT WARNING IN L =item $obj-EB() Returns whether one of the spam groups defines a report about spam. If there are not header fields in the message which relate to spam-detection software, C is returned. The spamgroups which report spam are returned. » example: $message->delete if $message->spamDetected; defined $message->spamDetected or call_spamassassin($message); =item $obj-EB( [$names] ) Returns a list of L objects, each collecting some lines which contain spam fighting information. When any C<$names> are given, then only these groups are returned. See also L and L. In scalar context, with exactly one NAME specified, that group will be returned. With more C<$names> or without C<$names>, a list will be returned (which defaults to the length of the list in scalar context). » example: use of listGroup() my @sg = $msg->head->spamGroups; $sg[0]->print(\*STDERR); $sg[-1]->delete; my $sg = $msg->head->spamGroups('SpamAssassin'); =item $obj-EB() Returns the whole header as one scalar (in scalar context) or list of lines (list context). Triggers completion. =item $obj-EB( $name, [$index] ) Inherited, see L =back =head2 About the body Extends L<"About the body" in Mail::Message::Head|Mail::Message::Head/"About the body">. =over 4 =item $obj-EB() Inherited, see L =item $obj-EB() Make a guess about when the message was origanally posted, based on the information found in the header's C field. For some kinds of folders, L may produce a better result, for instance by looking at the modification time of the file in which the message is stored. Also some protocols, like POP can supply that information. =item $obj-EB() Inherited, see L =item $obj-EB() Returns an indication about when the message was sent, but only using the C field in the header as last resort: we do not trust the sender of the message to specify the correct date. See L when you do trust the sender. Many spam producers fake a date, which mess up the order of receiving things. The timestamp which is produced is derived from the Received headers, if they are present, and C otherwise. The timestamp is encoded as C