Preface
First off, if this sounds useful, I might be willing to take a stab at it, if someone could give me a high-level intro of where to start (what files to create, where to look for good example code, etc..)
The Problem
The nature of my Phabricator install leaves us unable to receive inbound email. It is hosted on a machine in the office that cannot in any way be accessed by the outside world. (IT, bureaucracy, etc...).
The inbound setup steps for the current Mailgun adapter require that Mailgun users configure a catchall() route with the action forward("http://my.install.url/mail/mailgun")
Mailgun supports an alternate action, store(), which keeps the inbound message available via a GET request for 3 days.
Idea
Create a daemon that polls Mailgun's HTTP API every n seconds.
- Make a GET to the /events endpoint, requesting all storage events with a filter akin to: where ID > { last known ID }
- Each item in the response contains a storage.url field.
- For each email waiting on the server, retrieve it via a GET to the URL provided in storage.url
- The response contains the entirety of the email (headers & message body)
That's it. It would be high value for my team, but I don't know how common our setup is.
Disclaimer
The author of this task didn't know what MTA stood for until about 45 minutes ago. Nuff said.