Amazon-SES

 view release on metacpan or  search on metacpan

lib/Amazon/SES.pm  view on Meta::CPAN

    

    method call(Str $action, HashRef $args? = {}) {
        $args->{AWSAccessKeyId} = $self->access_key;
        $args->{Action}         = $action;
        
        my $request = POST("https://email." . $self->region . ".amazonaws.com", $args);
        
        if ($self->{use_iam_role}) {
            my $creds = VM::EC2::Security::CredentialCache->get();
            defined($creds) || die("Unable to retrieve IAM role credentials");
            $self->{access_key} = $creds->accessKeyId;
            $self->{secret_key} = $creds->secretAccessKey;
            $request->header('x-amz-security-token' => $creds->sessionToken);
        }
        
        
        # Add the signature.
        my $signer = AWS::Signature4->new(-access_key => $self->access_key,
                                          -secret_key => $self->secret_key);
        $signer->sign($request);

lib/Amazon/SES.pm  view on Meta::CPAN

    ######### sending attachments
    my $msg = MIME::Entity->build();
    my $r = $ses->send( $msg );

=head1 DESCRIPTION

Implements Amazon Web Services' Simple Email Service (SES). Sess L<http://docs.aws.amazon.com/ses/latest/DeveloperGuide/Welcome.html> for details and to sign-up for the service.  Forked from Net::AWS::SES, changed to use Moops and updated to support ...

=head1 GETTING STARTED

After you sign-up for AWS SES service you need to create an C<IAM> credentials and create an C<access_key> and a C<secret_key>, which you will be needing to interface with the SES. Do not forget to grant permission to your C<IAM> to use SES. Read L<h...

=head1 METHODS

I attempted to make the method names as Perlish as possible, as opposed to direct copy/paste from the API reference. This way I felt you didn't have to be familiar with the full API reference in order to use the basic features of the service.

If you are avid AWS developer there is a C<call()> method, which gives you access to all the documented Query actions of the AWS SES. In fact, that's what all the methods use to hide the complexity of the request/response. There are few examples of t...

All the methods (including C<call()>) returns an instance of L<Response|Amazon::SES::Response>. You should check if the the call is success by testing for C<is_success> attribute of the response. If you want to gain full access to the raw parsed cone...

=head2 new(access_key => $key, secret_key => $s_key)

t/email-sender-transport-ses.t  view on Meta::CPAN

use MIME::Entity;
use LWP::UserAgent;
use Amazon::SES;
use Email::Sender::Simple qw(sendmail);
use Email::Simple;
use Email::Simple::Creator;
use Email::Sender::Transport::SES;
use VM::EC2::Security::CredentialCache;

BEGIN {
    # Try to get our credentials if it fails just skip these tests.
    my $creds;
    eval {
        alarm(4);
        $creds = VM::EC2::Security::CredentialCache->get();
    };
    if ($@ || !defined($creds)) {
        $ENV{NO_CREDS} = 1;
    }
}

t/iam-role.t  view on Meta::CPAN

use strict;
use warnings;
use Test::Modern qw(-internet -extended);
use MIME::Entity;
use LWP::UserAgent;
use Amazon::SES;
use VM::EC2::Security::CredentialCache;

BEGIN {
    # Try to get our credentials if it fails just skip these tests.
    my $creds;
    eval {
        alarm(10);
        $creds = VM::EC2::Security::CredentialCache->get();
    };
    if ($@ || !defined($creds)) {
        $ENV{NO_CREDS} = 1;
    }
}

t/iam-role.t~  view on Meta::CPAN

use strict;
use warnings;
use Test::Modern -internet;
use MIME::Entity;
use LWP::UserAgent;
use Amazon::SES;
use VM::EC2::Security::CredentialCache;

BEGIN {
    # Try to get our credentials if it fails just skip these tests.
    my $creds;
    eval {
        alarm(10);
        $creds = VM::EC2::Security::CredentialCache->get();
    };
    if ($@ || !defined($creds)) {
        $ENV{NO_CREDS} = 1;
    }
}



( run in 0.533 second using v1.01-cache-2.11-cpan-4d50c553e7e )