Tuesday, April 27, 2010

Mutt, Gmail, gdata, notify-send: A Perfect Email solution

Ever since I started working on my own, GMail has become my primary email account. I was mostly satisfied with the default web interface. However, the heavy javascript interface takes eternity to load on my slow network. The basic HTML interface is slim but doesn't have keyboard shortcuts, so it's useless. Moreover recently I found the GMail tab hogging most amount of memory in Chrome task manager. That gave me the final push to switch to a local email client.

I have used Thunderbird and Evolution in the past, but they are not light weight by any means. I had tried Mutt before, but left it because I didn't get hang of all its shortcuts. Nonetheless I decided to give Mutt another try.

Here are my basic requirements from the email setup:
1. Light weight - Should launch quickly when I want to check the mail. Should do only the bare minimum network I/O required to fetch new messages.
2. Notifications - Should check the mailbox at regular intervals and notify me using desktop's default notification system.
3. Access to GMail contacts
4. Ability to Archive messages or move them to other GMail folders.

So far I have figured out how to do all of the above and then some. So here are my solutions numbered same as corresponding requirements above.

1. Setting up GMail IMAP has become significantly easy. All you have to do it create a .muttrc file in your home directory and start mutt. A simple google search will tell you what to put in that file. As you kick off mutt from command line, it will fetch the contents of your gmail inbox seamlessly (except if you've skipped the password in .muttrc, then it will ask you to enter it).

2. Mutt does not support notifications. Apparently it doesn't fit into the design philosophy of its developers. But a brave soul has created a patch if you are interested in building your custom mutt. As for me, I didn't go that route. I setup an alternate script that uses GMail's gdata interface to check the new messages and delievers the alerts using notify-send (on my linux box) or growlnotify (on my Mac OSX). I took a simple script from here and added my modifications. You can get my version here. It reads the username and password from your .muttrc files. It does some rudimentary checks to find if it's on Linux or Mac OSX and accordingly calls notify-send or growlnotify; you might have to tweak the paths to suite your system.
[Now that I searched for it, I found many easy to use solutions for notifications. Nonetheless I enjoyed writing the script, so that's a plus for me.]

3. There is one straight forward solution for accessing GMail contacts from mutt - Goobook. It also uses the gdata interface, but it is a well packaged pypi project and once installed all you need to do is put set query_command = "goobook query '%s'" in your .muttrc.


4. If you delete messages from mutt, they are archived on your GMail server after you sync (keyboard shortcut $). GMail labels are virtual folders and they are visible from mutt as IMAP folders. Just press c and then TAB. If you want to move a message from your inbox to a specific folder, press s (for save) while you are viewing the message, you will be prompted for folder to save the message to. Press ? to get the list of IMAP folders and choose the one you want. I guess it's not possible to apply multiple labels to a message in this setup. The way I understand it is, GMail first designed labels and when they offered IMAP support they exposed labels as virtual folders over IMAP. So for any IMAP client they are folders and a single message cannot reside in multiple folders at the same time. (I might be wrong, give a shout if you know so).


A small tip for managing .muttrc. I use two machines a linux desktop and a Macbook with Mac OSX. I have set up both to use mutt. So instead of having duplicate copies of .muttrc, I have stored a common copy in my ~/Dropbox/config folder and I just source ~/Dropbox/config/.muttrc from my ~/.muttrc.


Hope you find my tips useful. If you have any of your own, feel free to put them in comments.

Ads:
Taming The Email Beast
Linux Administration Handbook (2nd Edition)
Unix and Linux System Administration Handbook (4th Edition)

Sunday, April 18, 2010

Are you the Matt Damon of your game?

This is generally a technical blog, but some observations, although non-technical, are too interesting to not write about. I love Hollywood movies and I like Matt Damon ones a lot. Until last night however I didn't realize the most interesting pattern in the roles Matt Damon has portrayed over the years. It struck me after I watched Rounders last night.

Count the number of movies in which Matt Damon has played a character who is the absolute genius of his field. Here is a list.
  1. Good Will Hunting A Math Prodigy
  2. The Rainmaker A talented lawyer who wins his first case barely out of the law school and against a behemoth Insurance company.
  3. Rounders A genius poker player
  4. The Talented Mr. Ripley A murderer who is unusually talented in covering his tracks
  5. The Legend of Bagger Vance A prodigy Golf player
  6. The Bourne {Identity, Supremacy, Ultimatum} A one of a kind CIA operative who is absolutely unbeatable
He has a thing about playing a genius, doesn't he? And no doubt he is very good at it too. All his characters are thoroughly entertaining and deeply inspirational at the same time.

Hoping to see his latest movie soon - Green zone.

Saturday, April 17, 2010

ReaderScope 1.9 - OAuth

For past month or so, some of you (ReaderScope users) might be facing problems if you were using AutoLogin. This happened after I updated the login mechanism in v1.8.2 to support Google Reader authentication changes. I won't go into the details, but AutoLogin is very likely to fail in the new scheme of authentication. So I advised some of you who sent me the error reports to switch to Username/Password login. It was a temporary solution.

Today I am glad to announce that starting with v1.9 ReaderScope supports OAuth login for Google Reader - the right way to login without password (compared to other password less alternatives at least).

This has been possible only after Google Reader team enabled OAuth login for their service a few weeks ago. I have been working since to get ReaderScope working with OAuth. Not all the time was spent on OAuth, but in order to implement OAuth I had redesign entire networking layer of ReaderScope (which I am glad I did because I could improve some things along the way).

Finally RS with OAuth is ready. If you were still using AutoLogin, then after upgrading to v1.9 you will get a warning message that AutoLogin is no longer supported and you will be automatically logged out. On restart you will be taken to Login screen where you can start doing OAuth login.

If you are using username/password, then after upgrading to v1.9 you will get a message informing that a new password less login option is available. You won't be forcefully logged out though. You can choose to logout and relogin.

I have been testing most of the functionality in past couple of days. But I won't be surprised if some holes were left out. Please report any problems you might face or sent crash reports if you get any.

Enjoy the upgrade!