NAME
Log::Handler::Logger::Email - Log messages as email (via Net::SMTP).
SYNOPSIS
use Log::Handler::Logger::Email
my $email = Log::Handler::Logger::Email->new(
);
$email->write($message);
DESCRIPTION
Log messages via email.
METHODS
new()
Call new()
to create a new Log::Handler::Logger::Email object.
The new()
method expected the options for the emailer.
write()
Call write()
if you want to log messages as email.
Example:
$email->write('this message will be emailed to all sub routines');
flush()
Call flush()
if you want to flush the buffered lines.
sendmail()
Call sendmail()
if you want to write an email.
errstr()
This function returns the last error message.
DESTROY
DESTROY
is defined and will flush the buffer.
OPTIONS
host
With this option you has to define the SMTP host to connect to.
host => 'mx.host.com'
# or
host => [ 'mx.host.example', 'mx.host-backup.example' ]
hello
Identify yourself with a HELO. The default is set to "EHLO BELO".
timeout
With this option you can set the maximum time in seconds to wait for a response from the SMTP server. The default is set to 120 seconds.
from
This sender address (MAIL FROM).
to
The receipient address (RCPT TO).
subject
The subject of the mail.
buffer and interval
Both options exists only for security. The thing is that it would be very bad if something wents wrong in your program and hundreds of mails would be send. For this reason you can set a buffer and a interval to take care.
With the buffer you can set the maximum size of the buffer in lines. If you set
buffer => 10
then 10 messages would be buffered.
With the interval you can set the interval in seconds to flush the buffer. "flush" means to send the complete buffer as one email.
Note that if the buffer is full and the interval is not expired then all further lines get lost - as a matter of course - because we don't want to blow our memory away. To flush the buffer every time if it's full you can set the interval to 0.
PREREQUISITES
Carp
Net::SMTP
Params::Validate
EXPORTS
No exports.
REPORT BUGS
Please report all bugs to <jschulz.cpan(at)bloonix.de>.
AUTHOR
Jonny Schulz <jschulz.cpan(at)bloonix.de>.
QUESTIONS
Do you have any questions or ideas?
MAIL: <jschulz.cpan(at)bloonix.de>
If you send me a mail then add Log::Handler into the subject.
COPYRIGHT
Copyright (C) 2007 by Jonny Schulz. All rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
DISCLAIMER OF WARRANTY
BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.