NAME

App::MonM::Message - The MonM Message manager

VERSION

Version 1.00

SYNOPSIS

    use App::MonM::Message;

    my $message = App::MonM::Message->new(
            recipient => "myaccount",
            to      => 'to@example.com',
            from    => 'from@example.com',
            subject => "Test message",
            body    => "Body of test message",
        );

DESCRIPTION

This is an extension for the monm messages

new

    my $message = App::MonM::Message->new(
            recipient => "myaccount",
            to      => 'to@example.com',
            cc      => 'cc@example.com',
            bcc     => 'bcc@example.com',
            from    => 'from@example.com',
            subject => "Test message",
            body    => "Body of test message",
            headers => { # optional
                    "X-My-Header" => "test",
                },
            contenttype => "text/plain", # optional
            charset     => "utf-8", # optional
            encoding    => "8bit", # optional
            attachment  => [{ # See Email::MIME
                filename => "screenshot.png",
                type     => "image/png",
                encoding => "base64",
                disposition => "attachment",
                path     => "/tmp/screenshot.png",
            }],
        );

Create new message

    my $message = App::MonM::Message->new;
    $message->load("test.msg") or die $message->error;

Load message from file

body

Returns body of message

email

    my $email_object = $message->email;

Returns Email::MIME object

    $message->email($email_object);

Sets Email::MIME object

error

    my $error = $message->error;

Returns error string

    $message->error( "error text" );

Sets error string

from

Returns the "From" header

genId

    my $message_id = $message->genId('to@example.com',"Test message");

Generate new ID of message

load

    my $message = App::MonM::Message->new;
    $message->load("test.msg") or die $message->error;

Load message from file

msgid

    my $MessageId = $message->msgid;

Returns MessageId (X-Message-ID)

recipient

    my $recipient = $message->recipient;

Returns recipient

save

    $message->save("test.msg") or die $message->error;

Save message to file

subject

Returns the Subject of message

to

Returns the "To" header

HISTORY

See Changes file

TO DO

See TODO file

SEE ALSO

Email::MIME

AUTHOR

Serż Minus (Sergey Lepenkov) https://www.serzik.com <abalama@cpan.org>

COPYRIGHT

Copyright (C) 1998-2022 D&D Corporation. All Rights Reserved

LICENSE

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

See LICENSE file and https://dev.perl.org/licenses/