Skip to content

Using the Bounce API

JP Toto edited this page May 14, 2013 · 4 revisions

The Postmark Bounce API is a useful tool for finding which emails bounced because of impossibly delivery. There are a variety of bounce types, all of which are available to sort with using the Postmark library.

PostmarkClient client = new PostmarkClient("YOUR_API_KEY");
var bounces = client.GetBounces(true, "[email protected]", 0, 100);

Searches for any bounces that are inactive (the email addresses are inactive on the Postmark system) to [email protected] while skipping none and limiting the list to 100.

Bounces are automatically deserialized into PostmarkBounce objects which, in JSON, look like:

{
  "ID": [ID],
  "Type": "HardBounce",
  "MessageID" : "d12c2f1c-60f3-4258-b163-d17052546ae4",
  "TypeCode" : 1,
  "Details": "test bounce",
  "Email": "[email protected]",
  "BouncedAt": "[YESTERDAY]",
  "DumpAvailable": true,
  "Inactive": true,
  "CanActivate": true,
  "Content" : "Return-Path:....",
  "Subject" : "Hello from our app!"
}

In order to retrieve the full dump of a bounce, you may use the client.GetBounceDump(ID) call and using the ID retrieved from the list of Bounces from the GetBounces() call.

Getting Used Tags

client.GetBounceTags() will retrieve a list of tags that have been used for sending messages over the history of the server you're querying (by API key).

Clone this wiki locally