Tuesday, February 22, 2011

Google contacts with sup email client.


Recently I found about sup [1] and gave it a try to replace mutt. One of my requirements is access to my Gmail contacts from within the client so I can auto-complete the To, CC and BCC fields with my already registered contacts.

Fortunately I already had a ruby script to integrate Gmail contacts with mutt [2] and since sup can be extended via ruby scripts it was extremely easy to get my script working with sup.

SUP email client with Gmail contacts

Sup hooks system [3] is very powerful and allows us to add all kinds of functionality to sup using simple ruby scripts. One such hooks is called "extra-contact-addresses.rb" and from the hooks documentation we can read:

What this means is that we must create an script inside our $HOME/.sup/hooks directory called extra-contact-addresses.rb that returns an array of email addresses in plain format (e.g. myemail@gmail.com) or full format (e.g. User Name <username@gmail.com>).

Here is the script I implemented for this purpose:

Simply copy this script to "~/.sup/hooks/extra-contact-addresses.rb" and your are ready to go. When composing or replying and email you can press Tab to autocomplete email addresses.


[1] http://sup.rubyforge.org/
[2] http://piao-tech.blogspot.com/2010/01/google-contacts-in-mutt.html
[3] http://sup.rubyforge.org/wiki/wiki.pl?Hooks