Ka Wai Cheung

Emailin’ ain’t easy

Feb 2017

We launched one of our biggest features in August, 2013: Public Issues. Public Issues extend DoneDone from an issue tracking tool for internal teams to a customer support portal for everyone.

Each project comes with a uniquely-generated email address (like [email protected]) that anyone can send emails to. DoneDone converts the email into a public issue which provide all the same internal goodies of a normal issue, but with the added ability to reply directly to the customer. This way, you can simultaneously work on the issue with your team inside of DoneDone while having a tracked conversation with your customer over email. From the vantage point of the outside customer, the UI for public issues is plain old email.

Here's the play-by-play of how a public issue's created and updated through an email chain:

After we launched, many customers wanted us to track cc'd users. This made a lot of sense to us—if public issues felt like email to an outsider, well then, it should feel like email in every way. So, we added some additional functionality to capture cc'd email addresses from the outsider, and also allowed the internal team to add and edit cc'd email addresses inside of DoneDone.

There's a fair bit of complexity here, but overall it was a straightforward initial implementation. Or, so we thought.

What happens if an outsider replies to an email from DoneDone while also cc'ing a random separate public issue address? So, we added a check that if more than one DoneDone address is added to an incoming email, a replied email would take priority, and any other emails processed would be disregarded.

What if a cc'd user replies to the original email someone sent into DoneDone? We wouldn't want to create a new public issue; instead, it would be more appropriate to add a comment in the issue that was created by the original email. So, we added some new logic to store every incoming email's message ID, a GUID applied to every email in flight so that we could check any replies to the same message before assuming an email was truly "new".

What if the email address of the submitter of a public issue was actually the forwarding address to a DoneDone public issue address? Then, any replies to the submitter would boomerang the email right back into DoneDone—we'd be emailing into a mirror.

Granted, no one in their right mind would set things up that way, except the guy that hooked up his Amazon Echo and Google Home in an infinite calendar reminder loop. So, we added some additional logic to disregard any emails original sent from DoneDone.

All kinds of these strange scenarios cropped up in the first few weeks of our release. It led to some pretty wild, head-banging-against-the-wall scenarios that we needed to account for, which in turn, led to some pretty fantastic code comments.

"Code Tells You How, Comments Tell You Why"—Jeff Atwood

The lesson in all of this? For as much as most of us view email as a relic of a time long ago, it holds a lot more complexity than you might think at first glance. Emailin' ain't easy.