NAME

Log::Log4perl::Appender::AmazonSES - Send via Amazon SES (SMTP over TLS)

SYNOPSIS

use Log::Log4perl::Appender::AmazonSES;

my $app = Log::Log4perl::Appender::AmazonSES->new(
  Host    => 'email-smtp.us-east-1.amazonaws.com',
  Port    => '465'
  Hello   => 'localhost.localdomain',
  Timeout => 2,
  Debug   => 0,
  from    => 'me@example.com',
  to      => 'you@example.com',
  subject => 'Alert: there has been an error',
);

$app->log(message => "A message via Amazon SES email");

DESCRIPTION

This appender uses the Net::SMTP module to send mail via Amazon SES. Essentially a flavor of Log::Log4perl::Appender::Net::SMTP with some intelligent options and restrictions.

This module was created to provide a straightforward, well-documented method for sending Log4perl alerts via Amazon SES. While other email appenders exist, getting them to work with modern, authenticated SMTP services can be challenging due to outdated dependencies or sparse documentation. This appender aims to "just work" by using Net::SMTP directly with the necessary options for SES.

OPTIONS

from (required)

The email address of the sender.

to (required)

The email address of the recipient. You can put several addresses separated by a comma.

subject (required)

The subject of the email.

Other Net::SMTP options
Hello

Defaults to your fully qualified host's name. You can also use domain.

Port

Default port for connection to the SMTP mail host. Amazon supports 25, 465, 587, 2587. The connection will be upgrade to SSL for non-SSL ports.

Default: 465

Debug

Outputs debug information from Net:::SMTP

Default: false

EXAMPLE LOG4PERL CONFIGURATION

Use Environment Variables (Best Practice)

log4perl.rootLogger = INFO, Mailer
log4perl.appender.Mailer = Log::Log4perl::Appender::AmazonSES
log4perl.appender.Mailer.from       = ...
log4perl.appender.Mailer.to         = ...
log4perl.appender.Mailer.subject    = ...
log4perl.appender.Mailer.layout = Log::Log4perl::Layout::PatternLayout
log4perl.appender.Mailer.layout.ConversionPattern = %d - %p > %m%n

Specify Credentials

log4perl.rootLogger = INFO, Mailer
log4perl.appender.Mailer = Log::Log4perl::Appender::AmazonSES
log4perl.appender.Mailer.from       = ...
log4perl.appender.Mailer.to         = ...
log4perl.appender.Mailer.subject    = ...
log4perl.appender.Mailer.auth.user       = <YOUR AMAZON SES USER>
log4perl.appender.Mailer.auth.password   = <YOUR AMAZON SES PASSWORD>
log4perl.appender.Mailer.layout = Log::Log4perl::Layout::PatternLayout
log4perl.appender.Mailer.layout.ConversionPattern = %d - %p > %m%n

AUTHENTICATION

You must either supply your authentication parameters in the configuration of set SES_SMTP_USER and SES_SMTP_PASS environment variables.

AUTHOR

Rob Lauer - <bigfoot@cpan.org>

LICENSE

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

SEE ALSO

Log::Log4perl, Net::SMTP