Making Email for Developers Easier
Back when I was a fresh-faced young web developer (just how much younger, I’ll leave to your imagination, though the fact that I was working with a Perl CGI script on a Netscape web server might give you some idea…), I was given the task of writing a script that would accept an email address from a web form and auto-reply an email with some bit of information (a thank-you note, if I recall correctly).
For obvious reasons, my script needed to parse the submitted data to make sure the user had entered a valid email address. Easy, I thought; the regular expression was going to be really straight-forward. I think I came up with something like “ \w+@[\w\.]+ ” After I had built out enough code to get a working demo, I showed the senior programmer on our team my work. He just shook his head, and promptly schooled me on how sloppy my assumptions were and showed me why my regex was many orders of magnitude insufficient. If you’ve ever tried to grep email addresses, you know how hard it is to write a regular expression that covers all of the bizarre edge cases.
Fast forward to today, and you can understand why I lol-ed reading the title of a blog post written by a developer a few years ago: “I Knew How to Validate an Email Address Until I Read the RFC.” The more things change…
The task of grepping a valid email address neatly captures the exasperation that nearly every developer who works with email has felt at some point. There’s really no getting around it: email can be a pretty strange beast with conventions, dependencies, and quirks unlike anything else, and many of us have a love/hate relationship with making it work. We love email because it’s ubiquitous, open, flexible, and effective; we hate—or perhaps have learned to treat it with a wary respect—because getting an email from point A to inbox B has so many variables outside our control. In short, it’s easy to feel like “I Knew How Email Worked Until I Started to Build an App that Sends Email.”
Fortunately, services like SparkPost let developers offload the operational considerations of building and hosting email infrastructure. We deal with the challenges of sending email at scale, the arcana of sender authentication, and the weeds of email deliverability so you don’t have to.
But even so, if you’re building email into your app or business process, email presents a number of messy details and idiosyncrasies that turn out to be gotchas for many developers. So, to save you a little bit of grief as you dig into the quirks of email, check out “The Developer’s Survival Guide to Email.” It’s an easy read that highlights 10 things builders new to email might not realize about implementing and sending email (and gives some great tips for solving them) – email for developers!
Let me know what you think. What are some of the things that surprised you about email as you began working with it? I’d love to hear about the challenges (and solutions!) you found.