Skip to content

Instantly share code, notes, and snippets.

@bugnumber9
Forked from PhilETaylor/deleteAll.php
Created March 4, 2024 11:04
Show Gist options
  • Select an option

  • Save bugnumber9/92d1e60885de96016be7edca86fcc2a6 to your computer and use it in GitHub Desktop.

Select an option

Save bugnumber9/92d1e60885de96016be7edca86fcc2a6 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