Sunday, September 20, 2009

One Mutt to rule them all.

This will be the explanation of how I (known mutt fan) have set up just a few small tools in order to have access to multiple email accounts at the same time using mutt. I am still sure that I process a great deal more email more efficiently than my peers because I am reducing my Internet world to the lowest common denominator -- text.

With just the rendering time enhancement of html/rtf formatted emails to text I have a 25% better visualization time of email. With the use of powerful text editors (in my case vim) my reply time is also quicker. I have yet to see an email interface that is as speedy. I have to say that the web interface on gmail is pretty snappy and offers threaded views inline thus speeding up the reading of conversations. I still find it falls short of the raw speed offered by mutt.

With this in mind, I even apply this to my personal email. One of the challenges that my counterparts complain to me about is that since their work day is consumed with email that they neither have time during working hours to look after their personal email accounts nor do they have the enthusiasm to check their personal during their private time. I find that with my ease of use, that I can apply all the attention needed to both either in the office or out.

First, I made a folder that will hold all of my mutt configuration files. Everything from my alias file (address book) to my mutt color file. All of the "dot" files and the individual muttrc files will go into one folder. This is not so terribly important for the function, but is important later as I integrate a backup/restore plan.

Second, multiple muttrc files should be prepared, one for each account. I will confess that in an effort to make my email OS ambiguous and accessible I am using IMAP with accounts that also offer a web interface. This is key to my explanation since it doesn't require the work of setting up fetchmail, or hassle with odd protocols (i.e. Exchange). I won't be going into the details of the options of the muttrc, if you have looked at them, there are a great many. But for sure a single file for a single account is important. In this manner, we can avoid mis-configuration of the profiles options and we don't end up with a config file that is 1 mb in size.

Lastly the commands. The command, being launched from the same folder as the config file should read "mutt -F muttrc-file-for-this-email". My little hack that makes this quite manageable is that I have set multiple alias's in my .bashrc file that make simple ways to remember the accounts. Let me give you examples. I have set in my .bashrc the following:
alias email-cafeninja="cd ~/mutt-conf && mutt -F muttrc-gmail-cafeninja"
This single line changes directory to the folder where all of my muttrc files are, and then executes mutt using the correctly named file. While the alias is auto completed using tab from the command line.

The last hack I did for this is a simple backup and restore script that makes a tarball of the entire folder and places that into my dropbox folder. The restore script copies the tarball to the home directory and extracts it overwriting the previous files. These two shell scripts I have placed in my ~/bin folder which is also in my path so that these scripts are also auto completed from the command line. With absolute path referenced, it does not matter where in the filesystem I am when I execute the email alias or the backup/restore process. Just to be sure it would be available, I placed a copy of the backup and restore script into the mutt-conf folder to be included in the mutt tarball that would sync on a new system. Of course, it would then need to be placed in the ~/bin folder on those systems as well for future use.

Here is my backup script:
#!/bin/bash

## Go home
cd ~

## make tar of ~/mutt-conf
tar pzcf ~/Dropbox/mutt-conf.tar.gz mutt-conf

Here is my restore script:
#!/bin/bash

## Go home
cd ~

## get tar and move to home dir
cp ~/Dropbox/mutt-conf.tar.gz .

## unzip tar
tar zxf mutt-conf.tar.gz

## remove copied tar once done
rm mutt-conf.tar.gz


I hope this might help anyone who is working with multiple email accounts on multiple systems who thought it might be difficult to get it all working. I'm sure there are more complex solutions available, I built mine with the idea that each email account was siloed and would not corrupt other email account setting should anything happen to a single file.

--
CafeNinja

No comments: