Emailin’ ain’t easy

Ka Wai Cheung
The Stories of DoneDone
3 min readFeb 17, 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 abcde123456@mydonedone.com) 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:

  • Someone sends an email to DoneDone’s uniquely-generated project email address. (Many of our subscribers actually use their own support email address that forwards to the generated email)
  • The email comes into DoneDone’s catch-all Gmail account and forwards the email to Postmark, a wonderful service by the team at Wildbit. Postmark then parses the email to a programmatically-useful JSON object and sends the data securely over the wire to a webhook on our side.
  • DoneDone receives the data, vets the uniquely-generated address and creates a public issue in the project based on the email address it was delivered to. The email subject converts to an issue title. The email body converts to an issue description. The original sender becomes the “submitter” of the issue whom the internal team can reply to through the system. The submitter interacts with the internal team strictly over email.
  • When internal team members reply to the submitter, DoneDone creates a new unique reply-to address on the email sent to the customer so any replies to that email will correctly map back to the right issue.

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.

--

--

Ka Wai Cheung
The Stories of DoneDone

I write about software, design, fatherhood, and nostalgia usually. Dad to a boy and a girl. Creator of donedone.com. More at kawaicheung.io.