The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

MIME::Signature - appends signature to mail messages

VERSION

Version 0.16

SYNOPSIS

    my $ms = MIME::Signature->new(
        plain => 'Das ist der Rand von Ostermundigen.' 
    );
    $ms->parse( \*STDIN );
    $ms->append;
    $ms->entity->print;

Or, alternatively:

    my $ms = MIME::Signature->new(
        plain => 'Das ist der Rand von Ostermundigen.' 
    );
    my $entity = MIME::Parser->new->parse( \*STDIN );
    $ms->append($entity);
    $entity->print;

Or even:

    MIME::Signature->new(
        plain => 'Das ist der Rand von Ostermundigen.',
        parse => \*STDIN
    )->append->print;

DESCRIPTION

This module appends a signature to an e-mail messages. It tries its best to cope with any encodings and MIME structures.

METHODS

->new

Constructs a MIME::Signature object. You may optionally pass additional method => argument pairs as a shortcut to calling the respective methods. (This only works for methods which require exactly one argument.)

->plain

Sets and/or returns the plaintext version of the signature to append.

->enriched

Sets and/or returns the enriched text version of the signature to append.

->html

Sets and/or returns the HTML version of the signature to append. If not given, will be automatically deducted from the plaintext version.

->plain_delimiter

Sets and/or returns the delimiter to insert before the signature within a text/plain part.

Default: \n\n-- \n

->enriched_delimiter

Sets and/or returns the delimiter to insert before the signature within a text/enriched part.

Default: \n\n-- \n

->html_delimiter

Sets and/or returns the delimiter to insert before the signature within a text/html part.

Default: <hr>

->parse
->parse_data
->parse_open
->parse_two

These are wrappers to the methods of the same name from MIME::Parser to ease parsing of mail messages. Will store the MIME::Entity returned in the MIME::Signature object for further processing.

->parser

Gets or sets the MIME::Parser object used by the parse* methods mentioned above. If you do not supply a parser object, MIME::Signature will create one by itself as needed.

->entity

Gets or sets the MIME::Entity object which stores the mail message.

->unsign

When given a true value as argument, multipart/signed parts of the message will automatically be removed during ->append, so that we can append a (text) signature without invalidating the (cryptographic) signature.

->append

Appends the signature to the MIME::Entity stored in the MIME::Signature object. Alternatively you may supply a MIME::Entity object yourself which will then not be stored in the MIME::Signature object. In any case, the MIME::Entity object will be modified as the signature is added. Returns the MIME::Entity object.

This method will die if it cannot append a signature, e.g. because the mail does not contain a text/plain and/or text/html part or if the text is enclosed in a multipart/signed part and you have not specified "->unsign".

SUBCLASSING

The module uses the following methods to handle the respective MIME types. You may overwrite them and/or provide likely named additional handler methods to deal with other types.

The method gets passed the MIME part in question. It should alter this part if it wants to append the signature. It is expected to return a boolean value to signal success. That is, "->append" will croak when a handler method returns false.

->handler_multipart_alternative

appends the signature to any contained part

->handler_multipart_mixed

appends another part with the signature inside

appends the signature to the first contained part

->handler_multipart_signed

If "-unsign" is set, replaces the multipart/signed part by the first part it contains.

Returns false otherwise.

->handler_text_html

appends the HTML version of the signature to the end of the <body>

->handler_text_enriched

appends the enriched text version of the signature

->handler_text_plain

appends the plain version of the signature

AUTHOR

Martin H. Sluka, <fany@cpan.org>

BUGS

Please report any bugs or feature requests to bug-mime-signature at rt.cpan.org, or through the web interface at https://rt.cpan.org/NoAuth/ReportBug.html?Queue=MIME-Signature. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc MIME::Signature

You can also look for information at:

ACKNOWLEDGEMENTS

LICENSE AND COPYRIGHT

Copyright 2018 Martin H. Sluka.

This program is free software; you can redistribute it and/or modify it under the terms of the the Artistic License (2.0). You may obtain a copy of the full license at:

http://www.perlfoundation.org/artistic_license_2_0

Any use, modification, and distribution of the Standard or Modified Versions is governed by this Artistic License. By using, modifying or distributing the Package, you accept this license. Do not use, modify, or distribute the Package, if you do not accept this license.

If your Modified Version has been derived from a Modified Version made by someone other than you, you are nevertheless required to ensure that your Modified Version complies with the requirements of this license.

This license does not grant you the right to use any trademark, service mark, tradename, or logo of the Copyright Holder.

This license includes the non-exclusive, worldwide, free-of-charge patent license to make, have made, use, offer to sell, sell, import and otherwise transfer the Package with respect to any patent claims licensable by the Copyright Holder that are necessarily infringed by the Package. If you institute patent litigation (including a cross-claim or counterclaim) against any party alleging that the Package constitutes direct or contributory patent infringement, then this Artistic License to you shall terminate on the date that such litigation is filed.

Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.