Programming & Email

Do you ever wish you could write code to help deal with your email? Sometimes this type of niche nerdery appeals to me, but somehow I’ve never done it myself. Which might be because it’s not exactly the most straightforward and accessible thing to do. It’s not like Gmail has a settings panel you can pop open and write code that responds to incoming email events. (Arc boosts for email??)

If your really wanted to write code to control email as it comes in, where would you even start? I’m not sure I could have answered that question a few weeks ago, but since then I’ve read Martin Falkus’ Cloudflare Email Routing which introduced me to that concept. I’ve used Cloudflare Workers a number of times before, so this kind of thing feels relatable and comfortable:

They specifically call it “routing”, and I don’t see specifically see examples about messing with the email text itself in the docs, but it kinda seems possible? I’m thinking about that as that seems like potentially one of the most powerful things you can do. What if you could append to emails historical context based on what is going on in that email? (e.g. “this user has emailed you 4 times in the past year and you haven’t responded to any of them”, or “here’s a link to this user’s profile and billing history in the admin system”). And that happened at such a deep level that it doesn’t even matter what email client you use to read the email. Could be cool. They have HTML Rewriter so maybe if it doesn’t exist, it could.

Leave a Reply

%d bloggers like this: