Skip to content

Managing Suppressions

Vlad-Cosmin Sandu edited this page Apr 9, 2020 · 1 revision

The PostmarkClient allows you to create, delete (reactivate) or search for Suppressed recipients.

Get Suppressed Recipients:

use Postmark\PostmarkClient;

$client = new PostmarkClient("<server token>");

$messageStream = "outbound"; // MessageStream to search for Suppressions [optional - defaults to "outbound"]
$suppressionReason = "HardBounce"; // filter by Suppression reason [optional]
$origin = "Recipient"; // filter by Suppression Origin [optional]

$fromDate = "2020-03-01"; // filter from the specified date [optional]
$toDate = "2020-03-31"; // filter up to the specified date [optional]

$emailAddress = "bad-address@example.com"; // filter by email address [optional]

$result = $client->getSuppressions($messageStream, $suppressionReason, $origin, $fromDate, $toDate, $emailAddress);

Create Suppressions:

use Postmark\PostmarkClient;
use Postmark\Models\Suppressions\SuppressionChangeRequest;

$client = new PostmarkClient("<server token>");

$request = new SuppressionChangeRequest("bad-address@example.com");

$suppressionChanges = array($request);
$messageStream = "outbound";

$result = $client->createSuppressions($suppressionChanges, $messageStream);

Suppressions will be generated with a Customer Origin and will have a ManualSuppression reason.

Note: Requests are processed asynchronously and can take a minute until they become active.

Delete Suppressions:

use Postmark\PostmarkClient;
use Postmark\Models\Suppressions\SuppressionChangeRequest;

$client = new PostmarkClient("<server token>");

$request = new SuppressionChangeRequest("test-email@example.com");

$suppressionChanges = array($request);
$messageStream = "outbound";

$result = $client->deleteSuppressions($suppressionChanges, $messageStream);

Only Customer origin ManualSuppression suppressions and Recipient origin HardBounce suppressions can be reactivated.

Note: Requests are processed asynchronously and can take a minute until they become active.

For more information, please check our Suppressions API Documentation.