Skip to content

ctrlo/libemail-signature-perl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NAME

Email::Signature - adds a signature and attachments to a Mail::Message object

VERSION

Version 1.00

SYNOPSIS

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);

DESCRIPTION

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.

FUNCTIONS

new

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(0|1)

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($hashref)

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(Mail::Message)

sign() adds the previously defined signature to a Mail::Message. It returns the Mail::Message object with the signature added.

CAVEATS

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.

BUGS

Please use the libemail-signature-perl Github page.

SUPPORT

Please use the libemail-signature-perl Github page.

COPYRIGHT & LICENCE

Copyright 2014 Ctrl O Ltd

You may distribute this code under the same terms as Perl itself.

About

A Perl module for adding signatures to email messages

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages