Amazon SES wrapper and CP

Released 5 years ago , Last update 5 years ago

An API wrapper and control panel for the Amazon Simple Email Service (SES). Includes a ready Zend_Mail transport class for easy integration (commercial versions).

Amazon Simple Email Service (Amazon SES) is a scalable and cost-effective Email delivery service for businesses and developers. Benefits include Email delivery optimizations - highly increasing the chances that Emails do not get caught as SPAM, notifications on bounces, rejections or complaints, and very low costs compared to alternatives (10 cents per 1000 Emails).

This class provides a wrapper for the Amazon SES API as well as a control panel to view account information and manage verified addresses.


  • Sends Emails through the Amazon SES REST API
  • Authenticates requests via custom HTTP headers, as required by the API
  • Provides methods for each of the service actions - Get send quota, Get send statistics, List verified Email addresses, Verify Email address, Delete verified Email address, Send Email and Send raw Email.
  • Supports multiple recipient types ('to','cc','bcc') and body types ('text','html')
  • Commercial versions include a control panel which retrieves and formats account information - send quota and statistics as well as the verified Email list. Verify Email address interface is provided.
  • A transport class is provided for the Zend Framework, for seamless integration with Zend_Mail (commercial versions).

Integration is simple once you have signed up to the Amazon SES service (see Usage instructions for more details).

  • 5 2
  • 4 0
  • 3 0
  • 2 0
  • 1 0
2 Reviews Read Reviews


14 day 14-day money-back guarantee


Free non-commercial

  • Perpetual license

  • 1 site, 1 server

  • No distribution (hosted use only)

  • Non-commercial use

  • Attribution required


Developer License

  • Perpetual license

  • Unlimited projects

  • Can distribute code and binary products

  • Commercial use

Usage instructions

To get started, you need to first sign-up to the Amazon Simple Email Service.

Once your account is active and you have access to your security keys, you can start using the API. To configure the class with your security keys you have two options:

  • Change the $accessKey and $privateKey variables in the class to your security keys appropriately.
  • Pass the security keys in an array to the class constructor when instancing the class. Use this way if you have several SES accounts you want to use.

Example using a configuration array:

$ses = new Lionite_AmazonSES( array (
     'accessKey' => 'SJVndj58Eghks98Eajgb68',
     'privateKey' => 'Jntu4bvf739d/g8bts9h57gaGNvhs85024nfNfjdgh856jd'

Sending Emails

Important: before you can send Emails, you must verify the Email addresses you intend to send from and to. Use the verifyEmail() method described on this page to do that, and click on the link in the verification Email sent to that address.

You can request production access from AWS to skip verifying recipient Email address.


This method is intended for direct use in your scripts.

The $recipients parameter can be either an Email string or an array of Emails. Advanced recipient types ('to','cc','bcc') can be specified by using indexed arrays. For example:

$recipients = array(
    'to' => array('' => 'John Doe'), // 'To' address
    'bcc' => array('' => 'Jane Joe') // 'Bcc' address

Note: you can use 'email' => 'name' pairs in the array to have named recipients.

The $from parameter can be either an Email string or an array of Emails, similar to the $recipients parameter. Instead of recipient types, you can specify the source of the Email (sent from) and the reply to addresses. Note that the source of the Email must be a verified Email address (see the verifyEmail() method below).

For example:

$from = array(
    'source' => array('' => 'Site name'), // 'From' address
    'reply' => array('' => 'Your name') // 'Reply-to' address

The $subject parameter is a string containing the subject line. The $body parameter can either be a string containing text body, or an array specifying HTML or mixed body. Use 'text' and 'html' as the array indexes to indicate body type. For example:

$body = array(
    'text' => 'This is a text version of the body',
    'html' => 'This is an HTML version of the body'


This method is intended for use by abstraction classes that generate Email headers, such as Zend_Mail and SwiftMailer. Direct input of Email headers allows a greater degree of control over advanced Email options. A transport class for Zend_Mail is included in this package.

The $to parameter can be either an Email string or an array of Email recipients. Compose the headers appropriately to control body type, recipients types and other advanced options.

The $from parameter should contain an Email string and must be a verified Email address (see below).

The $body and $headers parameters are strings containing the raw Email body and headers.

Verifying Email addresses

Verifying Email addresses is required to be able to send Emails. You can only send from verified addresses, and if you don't have production access yet you can only send to verified Email addresses as well.


This method accepts an Email address string for verification purposes. A verification Email will be sent to that addresses with a verification link. After the link is pressed, the address will be verified and you can use it to send and receive Emails using the SES service.


This method removes an Email address from the verified Email list. $email is an Email address string.


This method returns an array of the verified Email addresses.

Account status methods

The Amazon SES provides several methods to get data about the status of your account. A control panel that retrieves and formats this data is included in this package.


This method returns an array of the Email sending quotas - how many Emails were sent in the last 24 hours, how many can be sent every 24 hours and the maximum send rate per second.


This methods returns an array of usage statistics for your SES account. It includes Email sending numbers, rejections, bounces and complaints, grouped by time.

Control panel

The Amazon SES API provides several methods to get data about and manage your account. This package includes a ready control panel template that retrieves and formats account data and provides simple access to account management actions. See the screenshots for example data.

The control panel script is located at /examples/manage.php. Internally it uses a simple templating system that renders /examples/manage.phtml which is a template ready for use with many templating engines (such as Zend_View and Savant). You can use the control panel script as is or modify it and the template to suit your needs. It includes basic styling that can be seen in the screenshots to the right.

Along with the control panel, several example scripts are provided with this package -


Is used to send verification Email from an 'email' parameter in the $_GET array.


Is used to remove a verified Email address from an 'email' parameter in the $_GET array.


Is an example form that uses the sendEmail() method to demonstrate the basic way to send Emails.

Zend_Mail transport

Included in this package is a transport class for Zend_Mail for easy integration - it is not required at all for using the base API wrapper though. It is located under /Lionite/Mail/Transport/SES.php

As with other Zend_Mail transport classes, you pass an instance of the transport class into the send() method. Example:

$mail = new Zend_Mail();
// Set Email options such as recipient, subject and body

$transport = new Lionite_Mail_Transport_SES();
$mail -> send($transport);

You can pass your SES account security keys to the constructor of the transport class, the same as you would for the Lionite_AmazonSES class.

$transport = new Lionite_Mail_Tranport_SES( array (
    'accessKey' => 'SJVndj58Eghks98Eajgb68',
    'privateKey' => 'Jntu4bvf739d/g8bts9h57gaGNvhs85024nfNfjdgh856jd'

This is not needed if the Lionite_AmazonSES class is configured with your security keys.

3 licenses, starting from From » FREE View Licenses

Get A Quote

What do you need?
  • Custom development
  • Integration
  • Customization / Reskinning
  • Consultation
When do you need it?
  • Soon
  • Next week
  • Next month
  • Anytime

Thanks for getting in touch!

Your quote details have been received and we'll get back to you soon.

Or enter your name and Email
No comments have been posted yet.