Skip to content

Using the Bounce API

Andrew Theken edited this page Dec 11, 2014 · 4 revisions

The Postmark Bounce API is a powerful tool for finding which emails "bounced" -- which means that the destination server rejected the message for some reason, or the destination server didn't exist.

There are a variety of bounce types, all of which are available to sort with using the Postmark library.

var client = new PostmarkClient("SERVER_TOKEN");
var bounces = client.GetBounces(true, "john.appleseed@example.com", 0, 100);

The above searches for any bounces that are inactive (the email addresses are inactive on the Postmark system) to john.appleseed@example.com while skipping none and limiting the list to 100.

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

{
  "ID": 123456789,
  "Type": "HardBounce",
  "MessageID" : "d12c2f1c-60f3-4258-b163-d17052546ae4",
  "TypeCode" : 1,
  "Details": "test bounce",
  "Email": "john.appleseed@example.com",
  "BouncedAt": "2014-01-15T16:09:19.6421112-05:00",
  "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 (this is defined by the "SERVER_TOKEN" you passed when constructing your PostmarkClient.

Clone this wiki locally