alex chiang: web 6.0

October 2, 2007

mutt query gmail

Filed under: dreck — alex @ 10:36 am

mutt’s query_command is nice. And using gmail to archive all my mail is nice too. Managing mutt’s address book (flat text file) is somewhat annoying though.

Wouldn’t it be better if mutt could use gmail as an address book? Yeah, I thought so too.

To make this all work, you’ll need 3 things. The following instructions assume you know how to download and patch stuff.

First, download and install libgmail. Verify it works.

Then, stick the mutt_gmail_search script somewhere in your $PATH.

You will need to add the following to your .muttrc:

set query_command="mutt_gmail_search '%s'"

Now you can continue to use mutt as a front-end, gmail as your archiving back-end, and avoid having to manage your mutt address book. Enjoy!

edit: on 26 March 2008 — no longer need my patch against libgmail as it’s been accepted upstream; moved mutt_gmail_search to git repo

web 2.0 baby! These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • Facebook
  • e-mail
  • Reddit
  • Technorati

7 Responses to “mutt query gmail”

  1. alex chiang: web 6.0 » hooking up mutt and gmail Says:

    [...] mutt query gmail [...]

  2. thomas Says:

    hi alex,

    i’m not familiar with patching python scripts. please describe the second step more more detailed.

    thanks,
    thomas

  3. alex Says:

    Hi Thomas,

    Actually, upstream has accepted my patch, so you should just be able to pull from CVS to get the functionality.

    Thanks.

  4. thomas Says:

    thanks for that hint. i’ve downloaded the patched libgmail.py… i get the following error message after running the mutt_gmail_search script:

    HTTP Error 302: The HTTP server returned a redirect error that would lead to an infinite loop.
    The last 30x error message was:
    Moved Temporarily
    Successful. Saving to .muttgmailsearchrc

    any ideas? many thanks in advance.

  5. alex Says:

    Hi Thomas,

    Have you tried just using plain old libgmail to login to your account normally? Get that working first…

    Once you have verified that, I would remove ~/.muttgmailsearchrc, and run mutt_gmail_search manually from the command line. It should prompt you for your information and save it. (btw, if you are on a shared machine you might want to give that file 0600 permissions).

    Finally, once you have verified that mutt_gmail_search works from your command line, you can hook it up to mutt’s query command.

    Hope this helps.

  6. thomas Says:

    here ist the solution: http://www.castlecops.com/p1017858-http_error_302.html

    thanks for that great script!

  7. Gerolf Ziegenhain Says:

    I created a small patch for unicode-mess :(

    http://www.gerolf.ziegenhain.com/linux/content.html#configuration

    /Gerolf

Leave a Reply