PHPackages                             rafaame/php-aws-ses - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Mail &amp; Notifications](/categories/mail)
4. /
5. rafaame/php-aws-ses

ActiveLibrary[Mail &amp; Notifications](/categories/mail)

rafaame/php-aws-ses
===================

REST-based interface for Amazon Simple Mail Service (SES) written in PHP.

0.0.1(12y ago)039PHP

Since Jun 16Pushed 12y ago1 watchersCompare

[ Source](https://github.com/rafaame/php-aws-ses)[ Packagist](https://packagist.org/packages/rafaame/php-aws-ses)[ RSS](/packages/rafaame-php-aws-ses/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (2)Used By (0)

**Amazon Simple Email Service provides a simple way to send e-mails without having to maintain your own mail server. Those PHP classes use the REST-based interface to that service.**

---

> This repository is a fork from version 0.8.2 of the [original classes](http://www.orderingdisorder.com/aws/ses/) developed by **Dan Myers**

---

### Example usages

[](#example-usages)

A bit of example code will be a good demonstration of how simple this class is to use. Please read through these examples, and then feel free leave a comment if you have any questions or suggestions.

First, you’ll need to create a SimpleEmailService class object:

```
require_once('SimpleEmailService.php');
require_once('SimpleEmailServiceMessage.php');
require_once('SimpleEmailServiceRequest.php');
$ses = new SimpleEmailService('Access Key Here', 'Secret Key Here');

```

If this is your first time using Simple Email Service, you will need to request verification of at least one e-mail address, so you can send messages:

```
print_r($ses->verifyEmailAddress('user@example.com'));
-------
Array
(
  [RequestId] => 1b086469-291d-11e0-85af-df1284f62f28
)

```

Every request you make to SimpleEmailService will return a request id. This id may be useful if you need to contact AWS about any problems. For brevity, I will omit the request id if it is the only value returned from a service call.

After you’ve requested verification, you’ll get an e-mail at that address with a link. Click the link to get your address approved. Once you’ve done that, you can use it as the ‘From’ address in the e-mails you send through SES. If you don’t have production access yet, you’ll also need to request verification for all addresses you want to send mail to.

If you want to see what addresses have been verified on your account, it’s easy:

```
print_r($ses->listVerifiedEmailAddresses());
-------
Array
(
  [RequestId] => 77128e89-291d-11e0-986f-43f07db0572a
  [Addresses] => Array
    (
      [0] => user@example.com
      [1] => recipient@example.com
    )
)

```

Removing an address from the verified address list is just as easy:

```
$ses->deleteVerifiedEmailAddress('user@example.com');

```

This call will return a request id if you need it.

The only thing left to do is send an e-mail, so let’s try it. First, you’ll need a SimpleEmailServiceMessage object. Then, you’ll want to set various properties on the message. For example:

```
$m = new SimpleEmailServiceMessage();
$m->addTo('recipient@example.com');
$m->setFrom('user@example.com');
$m->setSubject('Hello, world!');
$m->setMessageFromString('This is the message body.');

print_r($ses->sendEmail($m));
-------
Array
(
  [MessageId] => 0000012dc5e4b4c0-b2c566ad-dcd0-4d23-bea5-f40da774033c-000000
  [RequestId] => 4953a96e-29d4-11e0-8907-21df9ed6ffe3
)

```

And that’s all there is to it!

There are a few more things you can do with this class. You can make two informational queries, try these out:

```
print_r($ses->getSendQuota());
print_r($ses->getSendStatistics());

```

For brevity I will not show the output of those two API calls. This information will help you keep track of the health of your account. See the Simple Email Service documentation on [GetSendQuota](http://docs.amazonwebservices.com/ses/latest/APIReference/API_GetSendQuota.html) and [GetSendStatistics](http://docs.amazonwebservices.com/ses/latest/APIReference/API_GetSendStatistics.html) for more information on these calls.

You can set multiple to/cc/bcc addresses, either individually or all at once:

```
$m->addTo('jim@example.com');
$m->addTo(array('dwight@example.com', 'angela@example.com'));
$m->addCC('holly@example.com');
$m->addCC(array('kelly@example.com', 'ryan@example.com'));
$m->addBCC('michael@example.com');
$m->addBCC(array('kevin@example.com', 'oscar@example.com'));

```

These calls are cumulative, so in the above example, three addresses end up in each of the To, CC, and BCC fields.

You can also set one or more Reply-To addresses:

```
$m->addReplyTo('andy@example.com');
$m->addReplyTo(array('stanley@example.com', 'erin@example.com'));

```

You can set a return path address:

```
$m->setReturnPath('noreply@example.com');

```

You can use the contents of a file as the message text instead of a string:

```
$m->setMessageFromFile('/path/to/some/file.txt');
// or from a URL, if allow_url_fopen is enabled:
$m->setMessageFromURL('http://example.com/somefile.txt');

```

If you have both a text version and an HTML version of your message, you can set both:

```
$m->setMessageFromString($text, $html);

```

Or from a pair of files instead:

```
$m->setMessageFromFile($textfilepath, $htmlfilepath);
// or from a URL, if allow_url_fopen is enabled:
$m->setMessageFromURL($texturl, $htmlurl);

```

Remember that setMessageFromString, setMessageFromFile, and setMessageFromURL are mutually exclusive. If you call more than one, then whichever call you make last will be the message used.

Finally, if you need to specify the character set used in the subject or message:

```
$m->setSubjectCharset('ISO-8859-1');
$m->setMessageCharset('ISO-8859-1');

```

The default is UTF-8 if you do not specify a charset, which is usually the right setting. You can read more information in the [SES API documentation](http://docs.amazonwebservices.com/ses/latest/APIReference/API_Content.html).

---

This library does not support **now supports** the `SendRawEmail` call, which means you cannot **can send emails with attachments** or custom headers, and unfortunately I will be unable to add that support.

The `SendRawEmail` call is used automatically when there are attachments:

```
$m->addAttachmentFromData('my_text_file.txt', 'Simple content', 'text/plain');
$m->addAttachmentFromFile('my_PFD_file.pdf', '/path/to/pdf/file', 'application/pdf');
// SendRawEmail call will now be used:
$ses->sendEmail($m);

```

### Changelog

[](#changelog)

v.0.8.3

- Made automatic use of `SendRawEmail` REST API call when there are attachments

v.0.8.2.

- Inital impport

### Todo List

[](#todo-list)

- Fully document the class methods with phpdoc tags
- Build documentation with phpDocumentor
- Move examples to files

[![Bitdeli Badge](https://camo.githubusercontent.com/1339b33944e9d3a99801dc13709cf34663e56ba58f25bcfbc3db6ddeea434656/68747470733a2f2f64327765637a68766c38323376302e636c6f756466726f6e742e6e65742f64616e69656c2d7a616861726965762f7068702d6177732d7365732f7472656e642e706e67)](https://bitdeli.com/free "Bitdeli Badge")

###  Health Score

25

—

LowBetter than 35% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 55.6% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

4400d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1192417?v=4)[Rafael Andreatta](/maintainers/rafaame)[@rafaame](https://github.com/rafaame)

---

Top Contributors

[![daniel-zahariev](https://avatars.githubusercontent.com/u/263063?v=4)](https://github.com/daniel-zahariev "daniel-zahariev (5 commits)")[![rafaame](https://avatars.githubusercontent.com/u/1192417?v=4)](https://github.com/rafaame "rafaame (3 commits)")[![bitdeli-chef](https://avatars.githubusercontent.com/u/3092978?v=4)](https://github.com/bitdeli-chef "bitdeli-chef (1 commits)")

---

Tags

phpawsses

### Embed Badge

![Health badge](/badges/rafaame-php-aws-ses/health.svg)

```
[![Health](https://phpackages.com/badges/rafaame-php-aws-ses/health.svg)](https://phpackages.com/packages/rafaame-php-aws-ses)
```

###  Alternatives

[async-aws/ses

SES client, part of the AWS SDK provided by AsyncAws.

5112.0M23](/packages/async-aws-ses)[renoki-co/laravel-aws-webhooks

Easy webhook handler for Laravel to catch AWS SNS notifications for various services.

73251.1k](/packages/renoki-co-laravel-aws-webhooks)[serendipity_hq/bundle-aws-ses-monitor

Symfony bundle to monitor AWS SES bounces, complaints and deliveries through SNS. Comes with a command to fully configure the topics and includes configurable SwiftMailer filter to avoid sending emails to bounced and complained emails.

1380.7k](/packages/serendipity-hq-bundle-aws-ses-monitor)[putyourlightson/craft-amazon-ses

Amazon SES mailer adapter.

1193.4k2](/packages/putyourlightson-craft-amazon-ses)[sunaoka/laravel-ses-template-driver

Amazon SES template mail driver for Laravel.

1093.8k](/packages/sunaoka-laravel-ses-template-driver)[juhasev/laravel-ses

Allows you to track opens, deliveries, bounces, complaints and clicked links when sending emails through Laravel and Amazon SES

1710.3k](/packages/juhasev-laravel-ses)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
