Helper for handling AWS SES with SNS
ag84ark/aws-ses-bounce-complaint-handler is a Laravel package for helper for handling aws ses with sns.
It currently has 0 GitHub stars and 151 downloads on Packagist (latest version 0.4.0).
Install it with composer require ag84ark/aws-ses-bounce-complaint-handler.
Discover more Laravel packages by ag84ark
or browse all Laravel packages to compare alternatives.
Last updated
Helper for handling AWS SES with SNS This works with HTTP(S) calls or SQS, HTTP(S) recommended! Take a look at contributing.md to see a to do list.
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
$email = "[email protected]";
AwsSesBounceComplaint::canSendToEmail($email);
Add in App\Providers\EventServiceProvider.php
class EventServiceProvider {
protected $listen = [
// ...
Illuminate\Mail\Events\MessageSending::class => [
App\Listeners\CheckEmailAddressBeforeSending::class,
],
];
}
In App\Listeners\CheckEmailAddressBeforeSending.php
<?php
namespace App\Listeners;
use ag84ark\AwsSesBounceComplaintHandler\AwsSesBounceComplaintHandler;
use Illuminate\Mail\Events\MessageSending;
class CheckEmailAddressBeforeSending
{
public function __construct()
{
//
}
public function handle(MessageSending $event): bool
{
$email = $event->data['email'];
if (!AwsSesBounceComplaintHandler::canSendToEmail($email)) {
\Log::info(json_encode($event->data));
// log the information in some way
return false;
}
return true;
}
}
$email = "[email protected]";
AwsSesBounceComplaint::ignoreEmail($email);
This will mark the entries to be ignored when running canSendToEmail but will only work if you run this after the email address was marked as bad. Useful in development.
$email = "[email protected]";
AwsSesBounceComplaint::clearEmail($email);
Please see the changelog for more information on what has changed recently.
$ composer test
Please see contributing.md for details and a todolist.
If you discover any security related issues, please email author email instead of using the issue tracker.
Please see the license file for more information.