Homec4science

(stable) Improve error and header behaviors for Mailgun received mail webhook

Authored by epriestley <git@epriestley.com> on Apr 2 2016, 19:34.

Description

(stable) Improve error and header behaviors for Mailgun received mail webhook

Summary:
Ref T10709. Two issues:

  • If a user sends an invalid !command, we can throw, which means we don't return HTTP 200. This makes Mailgun re-send the mail later.
  • We don't parse headers of the modern API correctly, so the "Message-ID" failsafe doesn't work. Parse them correctly. I believe Mailgun's API changed at some point.

Test Plan:
This is difficult to test exhaustively in isolation. I used Mailgun's web tools to verify the format of the hook request, and faked some requests locally.

I'll keep an eye on this as it goes to production and make sure the fix is correct there.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T10709

Differential Revision: https://secure.phabricator.com/D15575

Details

Committed
epriestley <git@epriestley.com>Apr 2 2016, 19:52
Pushed
aubortJan 31 2017, 17:16
Parents
rPH0b4be847a170: (stable) Promote 2016 Week 14
Branches
Unknown
Tags
Unknown

Event Timeline

epriestley <git@epriestley.com> committed rPHfea2389066ed: (stable) Improve error and header behaviors for Mailgun received mail webhook (authored by epriestley <git@epriestley.com>).Apr 2 2016, 19:52