Professor Pigeon!

Help Center

Mailhooks

This is a beta feature. Things will break! Please report any problems.

A mailhook is an email interface to APIs (think email + webhook). Email comes in on one side, and a structured API request comes out on the other. It’s the perfect way to move data from email into any external system in a neat and tidy manner.

Mailhooks are brand new around here, and so we welcome your testing. We’d strongly advise against incorporating them into any production workflows at this time, since there will inevitably be bugs and changes to the setup as we get things going here. Testing is encouraged, and reporting bugs is highly encouraged (send those to bugs@omg.lol).

Why Mailhooks?

This feature isn’t for everyone, to be clear. If you can’t see a good use for it, then that probably means it especially isn’t for you. That’s OK! You can ignore the feature entirely. Forget it’s even there.

The best way to explain why you’d want a mailhook is if you need to take the data from inbound email messages and incorporate it seamlessly into other data flows and processes. While the current beta implementation of our Mailhooks feature is fairly limited, the long-term goal is to enable powerful template-based email parsing (using regular expressions) combined with rulesets formed around logical operations. So, something like “if an email contains this word, POST it to this URL; if it contains some other word, perform a GET on this other URL and reply to the sender with the response; if none of the words are present delete the message and forget about it.” That kind of stuff. It’s gonna be fun.

Current Mailhooks Beta

The current beta implementation is really simple: take an incoming email and perform a REST action to any external service.

The data in inbound email messages can be accessed through variables using the format {{variable}}.

These variables are available: {{from}}, {{to}}, {{date}}, {{subject}}, {{headers}}, and {{body}}.

You must specify a Method for your mailhook, which can be GET, POST, PUT, PATCH, or DELETE.

You must specify a URL for your mailhook, which is where the data will be sent via the method specified.

You can optionally supply Headers for your request. Just add one header per line. You can use the {{content-length}} variable in conjunction with the Content-Length header if you’d like (the variable’s value will match the number of bytes of the data being sent).

You can optionally supply Data for your request, which is what will be sent to the URL specified via the method specified.

Finally, you can choose whether you want to forward the message on to your existing forwarding address(es), or discard it.

Updated 1 day ago Share feedback on this article