anyMail, Mozilla, Programming, Thunderbird, Toby

anyMail

Unlike most of my posts, this one isn’t about some new software I’ve written; it’s about some old software I’ve written.

In 2002, like any other college student out on his own for the first time, I decided to write my own e-mail client.

What – you haven’t written your own e-mail client? You will. As a complement to both Letts’ Law (“All programs evolve until they can send email”) and Zawinski’s Law (“Every program attempts to expand until it can read mail.”), I propose Finke’s Law: “All programmers will write their own mail client (and later regret it).”

I named my webmail client Toby and used it as my primary client for three years; once it was stable enough for other people to use, I started publishing updates on SourceForge (back before GitHub became the new SourceForge). Toby was my first legitimate open-source project.


Toby Web Mail, in its heyday, Outlook Express was a big influence. Also, the Pokemon cards were my brother’s.

In 2004, I needed a few more credits to finish my degree in Computer Science, and I opted to do an independent study under Joseph Konstan. (Professor Konstan was one of the only profs at the University of Minnesota at that time who had some involvement in Web software; the other one that I knew of was John Riedl, who was already the head of the fledgling Software Project class that I was a part of, which is a topic for another post.) For my project, I decided to refine my mail client, using IBM’s Remail prototype as a roadmap.

Over that semester, I rewrote Toby and branded it as anyMail. I don’t remember why I called it anyMail, but it was probably because it could connect to any IMAP or POP3 mail account. Clever.

Some of the features I planned on integrating into anyMail were inspired (read: stolen) from the very-new (at that time) Gmail; specifically, labels (instead of folders), the concept of “archiving”, and an entirely AJAX-based system for loading messages (although at that time, the term “AJAX” hadn’t been coined yet). However, one feature that I beat Google to was my own version of Priority Inbox. From my project proposal:

I intend to implement: […] Automatic sorting of incoming mail into different categories, such as read, unread, un-replied to, messages from people the user has replied to in the past, messages likely to be spam, messages from people in the user’s address book, etc. I feel that one of the largest areas for improvement in current Web mail clients is that of automatic information sorting and presentation.

(Of course, I wasn’t the first to ever think of this concept. Microsoft has prior art dating to the late ’90s.)

A concept I implemented from IBM’s Remail was thread arcs. Thread arcs are a way to visually represent a conversation using circles and arcs:

The hollow circles are messages sent by the user; the solid circles are replies. Clicking on a circle loads the corresponding message. Neat, but not terribly useful.

As far as I know, I was the only person to have implemented thread arcs outside of the Remail prototype at that time. They’ve gotten around by now; there is even a Thunderbird add-on that generates them.

So, fast-forward to a couple of days ago, where I had blissfully forgotten about the hundreds of hours I spent writing code to parse multipart e-mail. I was searching through my e-mail for something unrelated, and I happened across a conversation between myself and Rob Malda; I was applying for a job at Slashdot, and I had sent him a link to anyMail as a part of my application. The URL was dead, so I did the reasonable thing: hunted down a copy of the source code, upload it to that server, and get it to work.


Here goes nothing.

And it did work! After ten minutes of creating the necessary database tables and an email address to use for testing (I didn’t want to inadvertently wipe the contents of an important account – I trust my code, but I don’t trust trust it), I logged in and had a working instance of anyMail before me:

I played around, sent and received a few e-mails to confirm functionality, and was mostly pleased with how well anyMail held up.


The only flaw I found was that attachments didn’t get sent. That might be a misconfiguration my Web host though.

This was amazing to me. The last time I used anyMail, it was in Firefox 1.0, and it still works in Firefox 11 and Chrome Umpteen, without the benefit of a JavaScript library like jQuery doing the heavy lifting of cross-browser compatibility. It was also written in an environment with PHP < 4.3, and ran mostly without issue under PHP 5.2.

The other thing that surprised me was how consistent my coding style has been over the last eight years. Even though I was shocked and appalled by the gaping security holes (XSS, CSRF, and SQL injection issues were all present) and disgusted by the number of synchronous XHR calls, I was pleased to recognize the code as mine. I don’t specifically remember writing it, but I can tell by the formatting, variable names, and structure that it was formed by my hand.

I spent a few minutes cleaning up the code — some basic protection against XSS and SQL injection — and uploaded it to GitHub. I don’t expect anyone to use it (and I hope nobody does, at least not without modification), but I’m keeping it around so I can look back on it and learn from my mistakes. But hey, if you need a class to generate thread arcs in PHP or an email client that works in Firefox 1.0, you know where to look.

Update: Toby is no longer supported. I recommend using RoundCube Webmail instead.

Standard

2 comments on “anyMail

Leave a Reply

Your email address will not be published. Required fields are marked *