NAME
Haineko::SMTPD::Relay::AmazonSES - Amazon SES API class for sending email
DESCRIPTION
Send an email to a recipient via Amazon SES using API.
SYNOPSIS
use Haineko::SMTPD::Relay::AmazonSES;
my $h = { 'Subject' => 'Test', 'To' => 'neko@example.org' };
my $v = {
'username' => 'Access Key ID', 'password' => 'Secret Key',
'ehlo' => 'UserAgent name for Furl',
'mail' => 'kijitora@example.jp', 'rcpt' => 'neko@example.org',
'head' => $h, 'body' => 'Email message',
};
my $e = Haineko::SMTPD::Relay::AmazonSES->new( %$v );
my $s = $e->sendmail;
print $s; # 0 = Failed to send, 1 = Successfully sent
print $e->response->error; # 0 = No error, 1 = Error
print $e->response->dsn; # always returns undef
print $e->response->code; # HTTP response code from AmazonSES API
warn Data::Dumper::Dumper $e->response;
$VAR1 = bless( {
'dsn' => undef,
'error' => 0,
'code' => '200',
'message' => [ 'OK' ],
'command' => 'POST'
}, 'Haineko::SMTPD::Response' );
CLASS METHODS
new( %arguments )
new()
is a constructor of Haineko::SMTPD::Relay::AmazonSES
my $e = Haineko::SMTPD::Relay::AmazonSES->new(
'username' => 'username', # API Access Key ID for AmazonSES
'password' => 'password', # API Secret Key for AmazonSES
'timeout' => 60, # Timeout for Furl
'attr' => {
'content_type' => 'text/plain'
},
'head' => { # Email header
'Subject' => 'Test',
'To' => 'neko@example.org',
},
'body' => 'Email message', # Email body
'mail' => 'kijitora@example.jp',# Envelope sender
'rcpt' => 'cat@example.org', # Envelope recipient
);
INSTANCE METHODS
sendmail
sendmail()
will send email to the specified recipient via specified host.
my $e = Haineko::SMTPD::Relay::AmazonSES->new( %argvs );
print $e->sendmail; # 0 = Failed to send, 1 = Successfully sent
print Dumper $e->response; # Dumps Haineko::SMTPD::Response object
SEE ALSO
http://docs.aws.amazon.com/ses/latest/DeveloperGuide/query-interface.html
REPOSITORY
https://github.com/azumakuniyuki/Haineko
AUTHOR
azumakuniyuki <perl.org [at] azumakuniyuki.org>
LICENSE
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.