NAME
Log::Fine::Handle::Email::MIMELite - Email log messages using MIME::Lite
SYNOPSIS
Provides messaging to one or more email addresses via the MIME::Lite module.
use Log::Fine;
use Log::Fine::Formatter::Template;
use Log::Fine::Handle::Email;
use Log::Fine::Levels::Syslog qw( :macros :masks );
# Get a new logger
my $log = Log::Fine->logger("foo");
# Create a formatter object for subject line
my $subjfmt = Log::Fine::Formatter::Template
->new( name => 'template2',
template => "%%LEVEL%% : The angels have my blue box" );
# Create a formatted msg template
my $msgtmpl = <<EOF;
The program, $0, has encountered the following error condition:
%%MSG%% at %%TIME%%
Contact Operations at 1-800-555-5555 immediately!
EOF
my $bodyfmt = Log::Fine::Formatter::Template
->new( name => 'template2',
template => $msgtmpl );
# register an email handle
my $handle = Log::Fine::Handle::Email
->new( name => 'email0',
mask => LOGMASK_EMERG | LOGMASK_ALERT | LOGMASK_CRIT,
subject_formatter => $subjfmt,
body_formatter => $bodyfmt,
header_from => 'alerts@example.com',
header_to => 'critical_alerts@example.com',
email_handle => 'EmailSender', # <-- default value
envelope => {
to => [ 'critical_alerts@example.com',
'chris@example.com',
'joe@example.com'],
from => 'alerts@example.com',
}
);
# register the handle
$log->registerHandle($handle);
# log something
$log->log(CRIT, "Beware the weeping angels");
DESCRIPTION
Log::Fine::Handle::Email::MIMELite provides formatted message delivery to one or more email addresses via the MIME::Lite module and is intended for situations where the default Email::Sender module is not appropriate (such as older versions of perl).
Persons who wish to use this module are strong encouraged to read the MIME::Lite documentation!
METHODS
new
Constructor for this method
Parameters
In addition to the hash parameters specified in "msgWrite" in Log::Fine::Handle::Email, this class accepts the following keys:
All parameters below are passed in the envelope hash key unless otherwise specified.
method
The method by which the email will be sent. Valid options include 'sendmail' (default) and 'smtp'. See MIME::Lite documentation for further details.
options
Array ref containing options specific to the above method
msgWrite
Sends given email message via MIME::Lite module. Note that "_fatal" in Log::Fine will be called should there be a failure of delivery.
See also "msgWrite" in Log::Fine::Handle
BUGS
Please report any bugs or feature requests to bug-log-fine-handle-email at rt.cpan.org
, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Log-Fine. 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 Log::Fine
You can also look for information at:
AnnoCPAN: Annotated CPAN documentation
CPAN Ratings
RT: CPAN's request tracker
Search CPAN
REVISION INFORMATION
$Id: 5112fbbe7914ebfce7e7caa13f04af0c4a333cea $
AUTHOR
Christopher M. Fuhrman, <cfuhrman at panix.com>
SEE ALSO
perl, Log::Fine, Log::Fine::Handle, Log::Fine::Handle::Email, Mail::RFC822::Address
COPYRIGHT & LICENSE
Copyright (c) 2012 Christopher M. Fuhrman, All rights reserved.
This program is free software licensed under the...
The BSD License
The full text of the license can be found in the LICENSE file included with this module.