# Postmark bounce support?

**URL:** https://meta.discourse.org/t/postmark-bounce-support/47185
**Category:** Feature
**Created:** [July 12, 2016, 10:43pm UTC](https://meta.discourse.org/t/postmark-bounce-support/47185 "2016-07-12T22:43:06Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![watchmanmonitor](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/watchmanmonitor/32/430970_2.png) [@watchmanmonitor](https://meta.discourse.org/u/watchmanmonitor)
#### Post date: [July 12, 2016, 10:43pm UTC](https://meta.discourse.org/t/postmark-bounce-support/47185/1 "2016-07-12T22:43:06Z")

</div>

I’m a big fan of [Postmarkapp.com](https://postmarkapp.com/)

We use their bounce API to create tickets when emails need attention.

What would it take to expand Discourse’s [Bounce Processing](https://meta.discourse.org/t/handling-bouncing-e-mails/45343) to support Postmark?

See:

> **[Bounce API | Postmark Developer Documentation](https://postmarkapp.com/developer/api/bounce-api)**
>
> Use the Postmark Bounce API to delivery stats for your bounces for a single server.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [July 12, 2016, 11:16pm UTC](https://meta.discourse.org/t/postmark-bounce-support/47185/2 "2016-07-12T23:16:37Z")

</div>

We only support adding these sorts of things for mail services that have a free tier. Otherwise it doesn’t benefit enough people.

And for our hosted customers, we handle all email, so there’s no reason to do it for our customers.

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [July 13, 2016, 7:44am UTC](https://meta.discourse.org/t/postmark-bounce-support/47185/3 "2016-07-13T07:44:17Z")

</div>

Also, we haven’t used any “Bounce API” but rather “Bounce Webhooks” which is documented here

> **[Bounce webhook | Postmark Developer Documentation](https://postmarkapp.com/developer/webhooks/bounce-webhook)**
>
> Notify your app when an email bounces.

---

<div class="post-metadata">

### Author: ![wesochuck](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/wesochuck/32/108706_2.png) [@wesochuck](https://meta.discourse.org/u/wesochuck)
#### Post date: [February 10, 2020, 5:44pm UTC](https://meta.discourse.org/t/postmark-bounce-support/47185/4 "2020-02-10T17:44:40Z")

</div>

> [@codinghorror](#):
>
> We only support adding these sorts of things for mail services that have a free tier.

Would you consider a PR for postmark bounce webook support now? mailgun, one of the officially supported bounce providers, has now moved away their free tier. I get the impression that free-tiers are generally going away in this industry: [Tell HN: Mailgun lowers free-tier API from 10k to 625 emails per month | Hacker News](https://news.ycombinator.com/item?id=22192543)

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [February 10, 2020, 5:59pm UTC](https://meta.discourse.org/t/postmark-bounce-support/47185/5 "2020-02-10T17:59:16Z")

</div>

A PR would certainly be considered. Please communicate early if this providers differs too much from the current supported ones so we can offer feedback on the _mergeability_ of your approach.

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [February 10, 2020, 8:53pm UTC](https://meta.discourse.org/t/postmark-bounce-support/47185/6 "2020-02-10T20:53:30Z")

</div>

I’ve got this that I’m about to submit a PR.

Using the test `curl` command that they document [here](https://postmarkapp.com/developer/webhooks/bounce-webhook#bounce-webhook-data) on my development instance it looks like it will work.

I included `spec` tests for both hard and soft bounces.

EDIT: I’ve now done tests triggering from their webhook test interface and it looks like it actually works.

I think this should be OK: [add postmark webhook handling by pfaffman · Pull Request #8919 · discourse/discourse · GitHub](https://github.com/discourse/discourse/pull/8919)

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [February 11, 2020, 3:34pm UTC](https://meta.discourse.org/t/postmark-bounce-support/47185/7 "2020-02-11T15:34:08Z")

</div>

It’s merged! Thanks!

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [March 2, 2020, 8:54pm UTC](https://meta.discourse.org/t/postmark-bounce-support/47185/8 "2020-03-02T20:54:57Z")

</div>

@wesochuck suggests the following changes to Bounce types (see [Bounce API | Postmark Developer Documentation](https://postmarkapp.com/developer/api/bounce-api#bounce-types) for definitions of bounce types, though I’ve included them below).

To `hard_bounces` add:

- `BadEmailAddress` – “Invalid email address — The address is not a valid email address.”
- `Blocked` " **ISP block** — Blocked from this ISP due to content or blacklisting."

To Soft bounces add:

- `SMTPApiError` – " **SMTP API error** — An error occurred while accepting an email through the SMTP API."
- `DMARCPolicy` – “DMARC Policy — Email rejected due DMARC Policy.”

I think that `blocked` makes sense, but I’m not sure about the rest. Let me know what you think and I’ll make the PR accordingly.

### More info — The Postmark PR to handle webhooks doesn’t work

Sorry, but my PR doesn’t work.

First, Postmark throws away the message-id by default.

Second, the `MessageID` that Postmark includes in the webhook isn’t the `Message-ID` that is in the message.

From: [Everything you need to know about SMTP (Simple Mail Transfer Protocol) | Postmark](https://postmarkapp.com/developer/user-guide/sending-email/sending-with-smtp)

> [@](#):
>
> **Why isn’t my custom Message-ID being sent through Postmark?**
> 
> First, please note the difference between `MessageID` (which is generated by Postmark and cannot be changed), and `Message-ID` , which is the custom value you’re able to set via an SMTP header. The Postmark `MessageID` will always be what is returned in the “MessageID” field in webhook event JSON, so that you can identify the Postmark message for subsequent API calls.
> 
> By default, Postmark will replace all `Message-ID` headers for outbound SMTP messages. However, it can be useful to preserve `Message-ID` values for some applications that rely on them. To ensure that Postmark does not replace your custom or original `Message-ID` header, include an additional header called `X-PM-KeepID` with a value of `true` . Postmark will then pass on any original `Message-ID` header for the message.

Is there an easy way to add a `X-PM-KeepID: true` header in outgoing mail? Could **that** be added to core?

If that problem gets solved, then I’ll see about whether there is a way to have the actual `Message-ID` included in the webhook payload and process it accordingly.
