Skip to content

Instantly share code, notes, and snippets.

@PhilETaylor
Created March 3, 2024 19:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save PhilETaylor/ca72b2be1efadb83018061db2271be84 to your computer and use it in GitHub Desktop.
Save PhilETaylor/ca72b2be1efadb83018061db2271be84 to your computer and use it in GitHub Desktop.
<?php
# composer require aws/aws-sdk-php
use Aws\SesV2\SesV2Client;
require 'vendor/autoload.php';
define('AWS_ACCESS_KEY_ID', '');
define('AWS_SECRET_ACCESS_KEY', '');
$client = new SesV2Client([
'version' => 'latest',
'region' => 'eu-west-2',
'credentials' => [
'key' => AWS_ACCESS_KEY_ID,
'secret' => AWS_SECRET_ACCESS_KEY,
],
]);
$list = $client->listSuppressedDestinations()->get('SuppressedDestinationSummaries');
echo sprintf('There are %s emails to remove'.PHP_EOL, \count($list));
foreach ($list as $emailListed) {
echo 'Deleting Email: '.$emailListed['EmailAddress'].PHP_EOL;
$res = $client->deleteSuppressedDestination([
'EmailAddress' => $emailListed['EmailAddress'],
]);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment