Skip to content
This is the documentation for pieceofcake2/aws, a CakePHP 2.x plugin for pieceofcake2/cakephp. About this fork.

Amazon SES Email Transport ​

Aws.AmazonSesApi sends email with the SendEmail operation of the Amazon SES API v2. Set it as the transport of an email profile in config/email.php (legacy layout: app/Config/email.php):

php
class EmailConfig
{
    /**
     * Default email profile values.
     *
     * @var array
     */
    public $default = [
        'transport' => 'Aws.AmazonSesApi',
        'from' => 'example@example.com',
        'charset' => 'utf-8',
        'headerCharset' => 'utf-8',
    ];
}

The SES client is created with the Aws configuration. These keys of the email profile override it:

KeyDescription
regionAWS region of SES.
versionAPI version.
key, secretAccess key ID and secret access key. When they are not set, the credentials of the Aws configuration or the default credential provider chain are used.

The transport sends the text and HTML parts, the To, Cc, Bcc and Reply-To addresses, and the attachments. CakeEmail::send() returns the SES message ID as id:

php
App::uses('CakeEmail', 'Network/Email');

$email = new CakeEmail('default');
$result = $email->to('user@example.com')
    ->subject('Welcome')
    ->send('Hello!');

$messageId = $result['id'];

The sender address (from) must be verified in SES.

See LICENSE for copyright and license information. Not affiliated with the Cake Software Foundation.