App-MonM
view release on metacpan or search on metacpan
lib/App/MonM/Message.pm view on Meta::CPAN
package App::MonM::Message;
use warnings;
use strict;
use utf8;
=encoding utf-8
=head1 NAME
App::MonM::Message - The MonM Message manager
=head1 VERSION
Version 1.00
=head1 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",
);
=head1 DESCRIPTION
This is an extension for the monm messages
=head2 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
=head2 body
Returns body of message
=head2 email
my $email_object = $message->email;
Returns L<Email::MIME> object
$message->email($email_object);
Sets L<Email::MIME> object
=head2 error
my $error = $message->error;
Returns error string
$message->error( "error text" );
Sets error string
=head2 from
Returns the "From" header
=head2 genId
my $message_id = $message->genId('to@example.com',"Test message");
Generate new ID of message
=head2 load
my $message = App::MonM::Message->new;
$message->load("test.msg") or die $message->error;
Load message from file
=head2 msgid
my $MessageId = $message->msgid;
Returns MessageId (X-Message-ID)
=head2 recipient
my $recipient = $message->recipient;
( run in 1.288 second using v1.01-cache-2.11-cpan-df04353d9ac )