Handling bounces and complaints in AWS SES with Laravel

Viewed 2541

I have configured Laravel to send mails via SES smtp and it's working fine. I want to increase my email quota for 24 hours hence the handling bounces and complaints part. Currently, my quota is 200 mails per 24 hours and the mail sent are only for registration confirmation and password reset.

I need help with this, please.

1 Answers

I recently made ground with this.

I followed these steps from the link Amazon sent me https://aws.amazon.com/blogs/ses/handling-bounces-and-complaints/

Set up the following AWS components to handle bounce notifications:

  • Create an Amazon SQS queue named ses-bounces-queue.
  • Create an Amazon SNS topic named ses-bounces-topic.
  • Configure the Amazon SNS topic to publish to the SQS queue.
  • Configure Amazon SES to publish bounce notifications using ses-bounces-topic to ses-bounces-queue.

And then I installed this package because Out of the box, Laravel expects SQS messages to be generated in specific format https://github.com/dusterio/laravel-plain-sqs

I followed their setup instructions and created this Job. I was able to get a response from a SQS test message in any format and started this queue worker php artisan queue:work sqs-plain

ProcessFailedEmail.php

namespace App\Jobs;

use Dusterio\PlainSqs\Jobs\DispatcherJob;
use Illuminate\Contracts\Queue\Job;

class ProcessFailedEmail extends DispatcherJob
{
    protected $data;

    function __construct($data = null)
    {
        parent::__construct($data);
    }


    public function handle(Job $job, $data)
    {
        var_dump($data);
    }
}

sqs-plain.php

/**
 * List of plain SQS queues and their corresponding handling classes
 */
return [
    'handlers' => [
        'ses-bounces-queue' => App\Jobs\ProcessFailedEmail::class
    ],

    'default-handler' => App\Jobs\ProcessFailedEmail::class
];
Related