Handle_mail support for Postmark webhook

First time Discourse user, impressed at how well made but at the same hackable the app is! In order to avoid running a mail server I want to get Postmark working with Discourse. They have a webhook for inbound mail, that sends a JSON payload containing the parsed email. For example, it parses the From field into several attributes, same for the CC field, et c.

Optionally, you can tell Postmark to include the raw email in a RawEmail attribute. Unfortunately the name of the attribute cannot be changed to email, which is what Discourse’s handle_mail endpoint expects.

There are two options I can think of:

  1. add a one line bodge to handle_mail to rename the RawEmail attribute to email if present
  2. create a new endpoint that will add the ready parsed email to the job queue, then add a new method to the receiver to handle ready-parsed email objects

Any preference for a PR/way forward?

1 Like

@codinghorror are there any plans to replace existing handlers with Rails 6’s ActionMailbox in Discourse? It has ingresses for different services, including Postmark, built in.

No there are no current plans to swap in action mailbox, but I would be open to review a PR that swaps it in if you want to do a proof-of-concept.

1 Like