PHPackages                             ag84ark/aws-ses-bounce-complaint-handler - 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. ag84ark/aws-ses-bounce-complaint-handler

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

ag84ark/aws-ses-bounce-complaint-handler
========================================

Helper for handling AWS SES with SNS

0.4.0(5y ago)0148MITPHPCI failing

Since Jul 18Pushed 5y agoCompare

[ Source](https://github.com/ag84ark/aws-ses-bounce-complaint-handler)[ Packagist](https://packagist.org/packages/ag84ark/aws-ses-bounce-complaint-handler)[ Docs](https://github.com/ag84ark/aws-ses-bounce-complaint-handler)[ RSS](/packages/ag84ark-aws-ses-bounce-complaint-handler/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (3)Dependencies (6)Versions (6)Used By (0)

Aws Ses Bounce Complaint Helper
===============================

[](#aws-ses-bounce-complaint-helper)

[![GitHub build status](https://github.com/ag84ark/aws-ses-bounce-complaint-handler/workflows/Tests/badge.svg)](https://github.com/ag84ark/aws-ses-bounce-complaint-handler/actions)[![Latest Version on Packagist](https://camo.githubusercontent.com/a8fd3f82095593f90b97787d278466d9750709685d8690fa77db57c00c8acfc0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6167383461726b2f6177732d7365732d626f756e63652d636f6d706c61696e742d68616e646c65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/ag84ark/aws-ses-bounce-complaint-handler)[![Total Downloads](https://camo.githubusercontent.com/548f9732d257118fb08af6e6613851f2fbf7af884bf27af41471035f232dd962/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6167383461726b2f6177732d7365732d626f756e63652d636f6d706c61696e742d68616e646c65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/ag84ark/aws-ses-bounce-complaint-handler)[![Build Status](https://camo.githubusercontent.com/f76fef41875939cf4e0d8febf669a610c8ecbb7227cb1b44e5adc09e1cbb5af7/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f6167383461726b2f6177732d7365732d626f756e63652d636f6d706c61696e742d68616e646c65722f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/ag84ark/aws-ses-bounce-complaint-handler)[![StyleCI](https://camo.githubusercontent.com/0a5a2ec2ab0aab696977ad56b57345dcca30bbb9f6c2ecc405b8018077c7d2c0/68747470733a2f2f7374796c6563692e696f2f7265706f732f3238303533393030312f736869656c64)](https://styleci.io/repos/280539001)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/44f0dd71ababeeddb202ecb10e2d0fc10e06b4a97c955bd01fb71b06690ff51f/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6167383461726b2f6177732d7365732d626f756e63652d636f6d706c61696e742d68616e646c65722f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/ag84ark/aws-ses-bounce-complaint-handler/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/4e781777ad6fddb011287fd07cf0445752500698bc21974c5a75ed9a906a8470/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6167383461726b2f6177732d7365732d626f756e63652d636f6d706c61696e742d68616e646c65722f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/ag84ark/aws-ses-bounce-complaint-handler/?branch=master)

Helper for handling AWS SES with SNS This works with HTTP(S) calls or SQS, HTTP(S) recommended! Take a look at [contributing.md](contributing.md) to see a to do list.

Installation
------------

[](#installation)

Via Composer

```
$ composer require ag84ark/aws-ses-bounce-complaint-handler
```

---

Publish the migration and run them with:

```
php artisan vendor:publish --provider="ag84ark\AwsSesBounceComplaintHandler\AwsSesBounceComplaintHandlerServiceProvider" --tag="migrations"
php artisan migrate
```

---

You can publish the config file with:

```
php artisan vendor:publish --provider="ag84ark\AwsSesBounceComplaintHandler\AwsSesBounceComplaintHandlerServiceProvider" --tag="config"
```

---

Add the route to the except list in App\\Http\\Middleware\\VerifyCsrfToken.php

```
class VerifyCsrfToken extends Middleware
{
    protected $except = [
        // ...
        'amazon-sns/notifications'
    ];
}
```

Add link in AWS SNS for AWS SES email bounce and complains to: /amazon-sns/notifications
Also be sure to check the **Enable raw message delivery** option

---

Usage
-----

[](#usage)

#### Check to see if it is safe to send email

[](#check-to-see-if-it-is-safe-to-send-email)

```
$email = "me@example.com";
AwsSesBounceComplaint::canSendToEmail($email);
```

#### To stop emails from being sent to unsafe email addresses automatically

[](#to-stop-emails-from-being-sent-to-unsafe-email-addresses-automatically)

Add in App\\Providers\\EventServiceProvider.php

```
class EventServiceProvider {

    protected $listen = [
        // ...
        Illuminate\Mail\Events\MessageSending::class => [
            App\Listeners\CheckEmailAddressBeforeSending::class,
        ],
    ];
}
```

In App\\Listeners\\CheckEmailAddressBeforeSending.php

```
