Email::Signature - adds a signature and attachments to a Mail::Message object
Version 1.00
use Email::Signature;
my $msg = Mail::Message->new...
# Footer text
my $footer = {
plain => "Plain footer text",
html => "<b>HTML footer</b>"
}
my $emailsig = Email::Signature->new({ footer => $footer });
# Add some attachments
# First an inline one
$emailsig->attach {
cid = [email protected],
file = /var/emailsig/image1.jpeg,
mimetype = image/jpeg,
disposition = inline,
};
# Now attached normally
$emailsig->attach {
file = /var/emails/image2.jpeg,
mimetype = image/jpeg,
};
$msg = $emailsig->sign($msg);
Email::Signature is used to add a signature to emails. It tries to be as intelligent as possible. It attempts to position the signature as would be required by a normal user: for a reply that is top-posted, it tries to put it after the user's reply; for a bottom-posted or inline reply it adds it at the end.
Signatures can consist of HTML and plain text, plus attachments that can be either inline or normal attachments.
new
creates a new Email::Signature. It takes an optional argument of a hash with the key 'footer', containing the footer as per footer
, and/or key 'addHtmlPart' as per addHtmlPart
.
footer()
specifies the footer text for the signature. It takes a hashref, with the keys html
and plain
. HTML can include image tags that specify the content-IDs of images added later.
addHtmlPart()
specifies whether to add a HTML part if it is missing. It takes a value of 0 or 1 as required. If called without any arguments it returns the current setting.
attach()
attaches a single file. It can be called multiple times to attach several files. It takes a hashref, which at a minimum must specify file
and mimetype
keys. In addition, it may also contain cid
and disposition
keys.
sign()
adds the previously defined signature to a Mail::Message. It returns the Mail::Message object with the signature added.
Attempting to find the correct place to insert the footer is difficult. Only a limited number of email clients and languages have been provisioned for and tested. Please help by providing patches for better support.
Please use the libemail-signature-perl Github page.
Please use the libemail-signature-perl Github page.
Copyright 2014 Ctrl O Ltd
You may distribute this code under the same terms as Perl itself.