Laravel SES complaints and bounces manager

Overview

Laravel SES complaints and bounces manager

Latest Version on Packagist Total Downloads GitHub Actions

This package listens to AWS SNS notifications and stops sending mail to email addresses that have received a permanent bounced notification or users who have marked an email as spam.

How it works

This package intercepts each mail sent by your laravel application and check if the receiver has not marked your mail as SPAM or if the user email address received a permanent bounce notification from AWS SNS before. And according to your strategy defined in the config file, it stops the email sending process or sends the email.

Installation

You can install the package via composer:

composer require oza75/laravel-ses-complaints

Publish migrations files and config file

php artisan vendor:publish --provider="Oza75\LaravelSesComplaints\LaravelSesComplaintsServiceProvider"

Run migration

php artisan migrate

This command will create 2 tables in your database. sns_subscriptions table for sns subscription confirmation request and ses_notifications table to store complaint and bounce notifications received from SNS.

Usage

Create SNS topics

Go to your AWS SNS console and create two HTTP/S topic with these endpoints:

These endpoints can be customized in the config file. Note that as soon as you create these endpoints, they will be automatically confirmed. If not, you can use php artisan aws:sns:subscribe-url command to print out the SubscribeURL required to confirm subscription directly in your aws console. More details

Create SNS topics

Add SNS topics to your SES domain. More details

Config file

<?php

return [
    /**
     * If enabled is set to true, this package will intercept each mail then check
     * if the mail passes all middlewares defined in this config file. It will also
     * listen to sns notifications and store them in database. You may set enabled to false
     * to completed disabled this package
     */
    'enabled' => true,
    /*
     * Models used to created a new subscription confirmation request and
     * to store a sns notification received from aws.
     */
    'models' => [
        'subscription' => \Oza75\LaravelSesComplaints\Models\Subscription::class,
        'notification' => \Oza75\LaravelSesComplaints\Models\Notification::class,
    ],

    /**
     * Routes used to handle bounces notification and complaints notifications
     */
    'routes' => [
        'bounces' => '/aws/sns/ses/bounces',
        'complaints' => '/aws/sns/ses/complaints',
    ],

    // Controller used to handle all actions. You can override this if you want to add
    // more specific logic
    'controller' => \Oza75\LaravelSesComplaints\Controllers\SNSController::class,

    /**
     * An array of middleware that the email will go through. If only one return false
     * we do not send the email. All middlewares must implement the \Oza75\LaravelSesComplaints\Contracts\CheckMiddleware::class
     * interface.
     */
    'middlewares' => [
        \Oza75\LaravelSesComplaints\Middlewares\ComplaintCheckMiddleware::class => [
            /**
             * The max number of sns complaint notification before stop sending email to the user
             */
            'max_entries' => 1,
            /**
             * If the check_by_subject is set to true, we will count
             * the amount of complaint notification  received from sns and that has the same subject as
             * the email we are trying to send. If the count is greater or equal to max_entry we don't send
             * the email.
             */
            'check_by_subject' => true,
        ],
        \Oza75\LaravelSesComplaints\Middlewares\BounceCheckMiddleware::class => [
            /**
             * The max number of sns bounced notification before stop sending email to the user
             */
            'max_entries' => 3,
            /**
             * If the check_by_subject is set to true, we will count
             * the amount of bounced notification  received from sns and that has the same subject as
             * the email we are trying to send. If the count is greater or equal to max_entry we don't send
             * the email.
             */
            'check_by_subject' => false,
        ]
    ],
];

Testing

composer test

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

Laravel Package Boilerplate

This package was generated using the Laravel Package Boilerplate.

You might also like...
Demo and practice application with Laravel 8 and InertiaJS. (From laracasts course)
Demo and practice application with Laravel 8 and InertiaJS. (From laracasts course)

InertiaJS playground ⚽️ Started with the Laracasts: Build Modern Laravel Apps Using Inertia.js course and decided to share all my code here, I'll be a

Laravel 8 boilerplate in docker-compose with Treafik and SSL setup and github workflow ready for CI/CD pipeline

Laravel8 boilerplate Laravel 8 boilerplate in docker-compose with Treafik and SSL setup with .github workflow ready To start the containers in prod en

A Laravel 5 package that switchs default Laravel scaffolding/boilerplate to AdminLTE template and Pratt Landing Page with Bootstrap 3.0

AdminLTE template Laravel package A Laravel package that switch default Laravel scaffolding / boilerplate to AdminLTE template with Bootstrap 3.0 and

Base Laravel project with React and Laravel Sanctum authentication

About this project This is a base Laravel project with ReactJS frontend and Laravel Sanctum API authentication. You could read more about here. Instal

Laravel Quick-Start - a boilerplate for Laravel Application with typical packages preinstalled and configured

Laravel Quickstart is a boilerplate for Laravel Application with typical packages preinstalled and configured to extend a full-fledged application. We tried to make it as minimal as possible.

React laravel starter kit with tailwind css and vite js(laravel 9)

About Laravel Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experie

A Laravel Starter Kit for Laravel. Built with Laravel 8.
A Laravel Starter Kit for Laravel. Built with Laravel 8.

Laravel Get Started Project Laravel Get Started Project is a basic crud app built with laravel 8. In this app a basic product crud created. Features i

Admin Columns allows you to manage and organize columns in the posts, users, comments, and media lists tables in the WordPress admin panel.

Admin Columns allows you to manage and organize columns in the posts, users, comments, and media lists tables in the WordPress admin panel. Transform the WordPress admin screens into beautiful, clear overviews.

lara setups is a new star kit for installing latest and greetest version of vue js and bootstrap

Lara setups Introduction lara setups helps you to install latest bootstrap and vue.js version on your laravel project laravel team no longer supports

Owner
Aboubacar Ouattara
A computer enthusiast since the age of 12 :)
Aboubacar Ouattara
Registry manager for Laravel 5. An alternative for managing application configurations and settings.

Registry manager for Laravel 5. An alternative for managing application configurations and settings. Now with the magic of caching, so no more database calls to simply get site setting.

Daniel Stainback 22 Sep 28, 2020
Gestor de Contraseñas basado en Laravel 8 + PHP 8 + MySQL 8. Self-hosted Password Manager based on Laravel 8 + PHP 8 + MySQL 8.

English Gestor de Contraseñas Esta aplicación permite una gestión completa de contraseñas para múltiples tipos de servicios (web, ssh, teléfonos, wifi

Lito 134 Jan 2, 2023
A seamless django like admin panel setup for Laravel. Simple, non-cms table manager for admins.

Seamless Admin Panel A seamless Django-like admin panel setup for Laravel. Simple, non-cms table manager for admins. Installation steps Require the Pa

Advaith A J 15 Jan 2, 2023
🧿 Build navigation or menu for Laravel and Awes.io. Unlimited complexity and depth, with permissions and sorting support.

Navigator Laravel package that can easily create navigation menus of any complexity. With support for routing, permissions, sorting, rendering depth,

Awes.io 47 Jul 18, 2022
project with laravel 9 and php 8 and vuejs 3(modular) in both multi page and single page application

About Project Since Laravel 9 was recently released, it supports PHP 8 and above. So I decided to implement a prototype project using Laravel 9 + PHP

ali ahmadi 10 Sep 7, 2022
TweetNow is a Twitter clone created with Vue.js and Laravel. It is a social media platform that allows users to post short messages, follow other users, and engage in conversations through comments and likes.

TweetNow TweetNow is a opensource social media created with Vue.js+Inertia SSR and Laravel. It is a social media platform that allows users to post sh

I.E.U. Juboraj Naofel 12 Jun 16, 2023
Laravel and AngularJS Starter Application Boilerplate featuring Laravel 5.3 and AngularJS 1.5.8

?? Zemke/starter-laravel-angular has been upgraded to AngularJS 1.5.8. ?? Zemke/starter-laravel-angular has been upgraded to Laravel 5.3. You can pull

Florian Zemke 372 Nov 21, 2022
PHP Laravel, MySQL and AIML chatbot engine and admin portal

Lemur Engine The Lemur Engine is a PHP/MySQL/AIML Chatbot. Written using the Laravel Framework. Demo You can demo the bot at the website: https://lemu

The Ramen Robot Disco Code 18 Nov 8, 2022
A Laravel 8 and Vue 3 SPA boilerplate using tailwind styling and sanctum for authentication :ghost:

Laravel Vue Sanctum SPA Laravel and vue spa using tailwind (laravel/ui looks) for styling and sanctum for authentification Features Laravel 8 Vue + Vu

Hijen EL Khalifi 62 Dec 5, 2022