NAME
Mailmunge::Action::Boilerplate - Add boilerplate to text parts of a message
ABSTRACT
This class implements methods that let you add boilerplate text to the beginning or end of text/plain or text/html parts.
SYNOPSIS
package MyFilter;
use base qw(Mailmunge::Filter);
use Mailmunge::Action::Boilerplate;
sub filter_message {
my ($self, $ctx) = @_;
my $action = Mailmunge::Action::Boilerplate->new($self);
$action->add_text_boilerplate($ctx, $ctx->mime_entity,
"\nAnnoying plain-text boilerplate\n");
$action->add_html_boilerplate($ctx, $ctx->mime_entity,
"\n<p><b>Really</b> annoying HTML boilerplate</p>\n");
}
my $filter = MyFilter->new();
$filter->run();
1;
METHODS
Mailmunge::Action::Boilerplate->new($filter);
Constructor. Typically used within a filter file as follows:
my $action = Mailmunge::Action::Boilerplate->new($self);
add_text_boilerplate($ctx, $entity, $text, $at_start, $all)
$entity
must be the top-level MIME entity; typically, you would pass $ctx->entity
as the $entity
argument.
$text
is plain-text boilerplate.
If $at_start
is true, then the boilerplate is added at the beginning of the text/plain part(s). If false or omitted, the boilerplate is added at the end.
If $all
is true, then the boilerplate is added to all text/plain parts in the message. If false or omitted, the boilerplate is added only to the first text/plain part.
Note that you may need to include newlines liberally in $text
for best results.
add_html_boilerplate($ctx, $entity, $html, $at_start, $all)
$entity
must be the top-level MIME entity; typically, you would pass $ctx->entity
as the $entity
argument.
$html
is plain-text boilerplate.
$at_start
and $all
have the same meanings as in add_text_boilerplate
, but they apply to text/html parts rather than text/plain parts.
This function adds $html
boilerplate to the start or end of one or all of the text/html
parts in the message, depending on the values of $at_start
and $all
.
AUTHOR
Dianne Skoll <dianne@skollsoft.com>
LICENSE
This code is licensed under the terms of the GNU General Public License, version 2.
Copyright © 2024 Skoll Software Consulting