Amazon-SES
view release on metacpan or search on metacpan
lib/Amazon/SES.pm view on Meta::CPAN
multi method send(MIME::Entity $message) {
$self->send_mime($message);
}
multi method send(Str :$from,
Str :$body?,
Str :$body_html?,
Str :$to,
Str :$subject?,
Str :$charset = "UTF-8",
Str :$return_path?,
) {
$to = [$to] unless ref($to);
defined($body) || defined($body_html) || die("No body specified");
my %call_args = (
'Message.Subject.Data' => $subject,
'Message.Subject.Charset' => $charset,
'Source' => $from
);
if (defined($body)) {
$call_args{'Message.Body.Text.Data'} = $body;
$call_args{'Message.Body.Text.Charset'} = $charset;
}
if (defined($body_html)) {
$call_args{'Message.Body.Html.Data'} = $body_html;
$call_args{'Message.Body.Html.Charset'} = $charset;
}
if (defined($return_path)) {
$call_args{'ReturnPath'} = $return_path;
}
my $i = 1;
map {
$call_args{'Destination.ToAddresses.member.' . $i++} = $_;
} @$to;
lib/Amazon/SES.pm view on Meta::CPAN
to => '[destination email address]',
subject => 'Hello World'
body => 'Hello World'
);
unless ( $r->is_success ) {
die $r->error_message;
}
You may provide an alternate html content by passing C<body_html> header.
C<charset> of the e-mail is set to 'UTF-8'. As of this writing I didn't make any way to affect this.
Success calls also return a C<message_id>, which can be accessed using a shortcut C<$r->message_id> syntax. See L<Response class|Amazon::SES::Response>.
Sample successful response looks like this in JSON:
{
"MessageId": "00000141344ce1a8-0664c3c5-e9a0-4b47-aa2e-12b0bdf6070e-000000"
}
Sample error response looks like as:
( run in 0.247 second using v1.01-cache-2.11-cpan-4d50c553e7e )