A CodeIgniter library to interact with Amazon Web Services (AWS) Simple Email Service (SES). This library was designed with the standard CodeIgniter email class in mind. As a result, most methods look the same, ensuring a minimal learning curve.
NOTE: this code is still under heavy development and currently provides only the very basics of the AWS SES API (don't you like acronyms?), sending email.
- PHP 5.1+
- CodeIgniter 2.0+
- libcurl with OpenSSL support
- Phil Sturgeon's CodeIgniter cURL library
- A bundle of public root certificates (e.g. http://curl.haxx.se/ca/cacert.pem)
- An Amazon Web Services account
This library is also released as a Spark. If you use this library in any other way, don't copy the autoload.php to your config directory.
This library expects a configuration file to function correctly. A template for this file is provided with the library.
Before you can send your first message, Amazon SES requires that you verify your email address. This is to confirm that you own the email address, and to prevent others from using it.
Request to verify your email address as a sender.
Check whether a email address is verified as a sender.
Set the "To" address(es) for a message.
Set the "CC" address(es) (carbon copy) for a message.
Set the "BCC" address(es) (blind carbon copy) for a message.
$this->amazon_ses->bcc(array('email@example.com', 'firstname.lastname@example.org', 'email@example.com'));
These three methods expect valid e-mail addresses as a string, array or comma separated list.
Set the sender address. You can also set this in your config file. The second parameter - the vanity name of the sender - is optional.
$this->amazon_ses->from('firstname.lastname@example.org', 'Email monkey');
Set the subject for a message.
Set the message to be sent.
Set the alternative message (plain-text) to be sent. When not specified, an alternative message is generated by using PHP's strip_tags() function.
Sends the message. Returns true on success. You can pass a boolean as a first parameter to preserve the recipients after the message has been successfully send. This makes it possible to send an additional message without re-specifying the recipients.
NOTE: All methods above are chainable, which means you can do the following
Sends the message in debug mode. In debug mode, the send() methods returns the actual API response instead of a boolean. Call this method before calling the send method.
I am a firm believer of social coding, so if when you find a bug, please fork my code on GitHub and squash it. I will be happy to merge it back in to the code base (and add you to the "Thanks to" section). If you're not too comfortable using Git or messing with the inner workings of this library, please open a new issue.
- Phil Sturgeon, for creating the CodeIgniter cURL library and thus taking care of all the cURL hassle.
- Ben Hartard, for adding the email verification method.
- Stephen Frank, for sorting out SSL conflict issues.
- Fabio Borraccetti, for fixing a bug in the reply-to header.
- Spicer at Cloudmanic Labs, for some small fixes.