Small. Fast. Reliable.
Choose any three.
2005-Sep-30: A New Mail User Agent

Having become increasingly dissatisfied with existing Mail User Agents I decided to write my own. My first attempt is a single Tcl/Tk script, less than 4000 lines in length, which you can download from the attachments below. This script uses the following packages, all of which are included with ActiveTcl:

   package require sqlite3
   package require mime
   package require pop3
   package require smtp
   package require md4

The Problem To Be Solved

I have several complaints with existing MUAs. They generally have too much eye-candy for my taste. And I find them difficult to configure and use. But my biggest complaint is that they do not do a good job of managing historical mail archives.

I work on both fixed desktop systems and on my laptop. I would like to be able to check email from any system I am working on and yet have all my historical emails archived in the same database. To be more specific, I want to use my desktop in my office and my laptop when I'm travelling - I want to be able to check email from either machine - and I want to have access to the (gigabytes) of historical email from either system.

I have not found a good way to do that with previous MUAs.

My other big complaint is that it is difficult to find historical email messages. I want the equivalent of a google search for my email archives. (Note: gmail is not really an option for me because I need disconnected operation - I need to read historical emails on airplanes and in other places where internet is not available.)

Design Philosophy

This program is deliberately simple. It speaks POP3 and SMTP only. All email messages are stored in a single SQLite database.

The use of a single-file SQLite database allows me to easily move the data from laptop to desktop and back again as I move around. Furthermore, each email message is saved with a universally unique hash so that even if the two databases diverge, they can be easily resynchornized with each other.

The use of an SQL database makes searching much easier as well. As each message is inserted into the database, every work of text in the message (and in the subject and several other header lines) is indexed. This makes searching for old emails using keywords very fast, even with thousands and thousands of messages consuming gigabytes of space.

The current user interface will certainly not win any design awards. It is ugly. But it is functional. And functionality should come first. Beauty is nice to have too, and I would welcome any patches or suggestions to improve the appearence. But functionality needs to be the overriding principle.

Everything is shown in a single window. I find the usual 3-window layout with folders on the left, a list of message on top, and the current message on the bottom right to be needlessly complex. This MUA does not support folders because to my mind, folder management is way too much trouble than it is worth. Instead of folders, all email is stored in an SQLite database with full text searching built in. This allows me to find historical email much more quickly.

Emails are displayed in as text/plain only. I deliberately do not support text/html because I find that most HTML email is spam anyway. Anybody with something interesting to say usually sends plain text.

Implementation Notes

Tcl/Tk was used with Tcllib to simplify development.

The source code was original composed in multiple *.tcl files which are concatenated (in no particular order) to generate the finished program.

You can interactively change the running Tcl/Tk code using the "Tcl Proc Editor" available under the "Debug" menu option. You can also interactively type Tcl/Tk commands using the built-in Tcl console, or interact with the SQLite database using the built-in SQL console. Both consoles are also available under the Debug menu.

Comments Welcomed

As of this writing, the program works well enough that I am now using it for all of my personal and business email. But there is, of course, much room for improvement. Suggestions and/or patches are welcomed.

User comments

2005-Sep-30
If I understood you correctly I should be able to install ActiveTcl and run this app straight away?
I installed ActiveTcl 8.4.11.1 on Windows2000 but sqlite3 package is missing. Is there anything special that needs to be done to install sqlite3 from source so that ActiveTcl can find it?

Attachments:

  • ex-mua.zip 31441 bytes added by drh on 2005-Sep-30 13:48:08 UTC.
  • ex-mua-2006-01-27.zip 43927 bytes added by drh on 2006-Jan-27 13:57:14 UTC.
    The source code as of 2006-01-29