Haineko::SMTPD::Relay::AmazonSES - Amazon SES API class for sending email
Send an email to a recipient via Amazon SES using API.
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' );
new( %arguments )
new() is a constructor of Haineko::SMTPD::Relay::AmazonSES
new()
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 );
sendmail
sendmail() will send email to the specified recipient via specified host.
sendmail()
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
http://docs.aws.amazon.com/ses/latest/DeveloperGuide/query-interface.html
https://github.com/azumakuniyuki/Haineko
azumakuniyuki <perl.org [at] azumakuniyuki.org>
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Haineko, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Haineko
CPAN shell
perl -MCPAN -e shell install Haineko
For more information on module installation, please visit the detailed CPAN module installation guide.