-
Notifications
You must be signed in to change notification settings - Fork 48
Using the Bounce API
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, "[email protected]", 0, 100);
The above 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": 123456789,
"Type": "HardBounce",
"MessageID" : "d12c2f1c-60f3-4258-b163-d17052546ae4",
"TypeCode" : 1,
"Details": "test bounce",
"Email": "[email protected]",
"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.
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
.
The Postmark.Net client can be installed from NuGet.
For additional information about the capabilities of the Postmark API, see http://developer.postmarkapp.com/.
- Getting Started
- Version 2.0 Upgrade Guide
- Sending Email
- Searching Sent Messages
- Analyzing Sent Messages
- Processing Inbound Email
- Retrieving Message Statistics
- Handling Bounces
- Managing Suppressions
- Working with Message Streams
- Managing Your Account
- Troubleshooting Async&Await
- Version 1.x Overview
- Sending Email
- Sending Batch Emails
- Sending Attachments
- Sending Inline Images
- Using
MailMessage
- Using the Bounce API
- [Getting Send Statistics](Sending Statistics)
- Adding Custom Email Headers