The Lumber Room

"Consign them to dust and damp by way of preserving them"

Archive for July 2007

Using Gmail with mutt, the minimal way (IMAP update)

with 74 comments

As Gmail has IMAP access, it is fairly trivial to get it working with mutt. First, if you’re on Ubuntu/Debian, run sudo apt-get install openssl mutt to get mutt if you don’t already have it. Then, just put the following lines into your ~/.muttrc:

set imap_user = "username@gmail.com"
set imap_pass = "password"

set smtp_url = "smtp://username@smtp.gmail.com:587/"
set smtp_pass = "password"
set from = "username@gmail.com"
set realname = "Your Real Name"

set folder = "imaps://imap.gmail.com:993"
set spoolfile = "+INBOX"
set postponed="+[Gmail]/Drafts"

set header_cache=~/.mutt/cache/headers
set message_cachedir=~/.mutt/cache/bodies
set certificate_file=~/.mutt/certificates

set move = no

Make sure your ~/.muttrc isn’t world-readable; it contains your password. (Alternatively, you can leave them out and mutt will prompt you for the password each time.) Also, if you copy-paste from the above, make sure that you have only “normal” quotes, not “smart quotes” which WordPress might have inserted here into this post.

[Other things I have:

set sort = 'threads'
set sort_aux = 'last-date-received'
set imap_check_subscribed

ignore "Authentication-Results:"
ignore "DomainKey-Signature:"
ignore "DKIM-Signature:"
hdr_order Date From To Cc

I did not include above to justify the “minimal” :)]

Things work perfectly as you would expect them.
One thing to note is that the full headers will still contain the hostname of the computer you send messages from. I have not figured a way of hiding this, and perhaps it shouldn’t be possible.

The End

If for some reason you want to use POP, read on. And tell me why you would want to use POP. The rest of the post is an old version, which i had written before Gmail supported IMAP.

Old Stuff
There is a guide here, which is the first Google result on searching for the keywords Gmail, mutt and Ubuntu in any order, but I would advise against it: it does too much unnecessary stuff using too many unnecessary programs (okay if you don’t care), and involves putting your username and password in a world-readable file (not okay).

There is a guide here, but that site seems down, and so I guess it’s likely to be down again (a DynDNS domain; could be someone’s house), so putting a (fuller) guide here:

First, run sudo apt-get install openssl mutt

Next, in /etc/ssmtp/ssmtp.conf, put
mailhub=smtp.gmail.com:465
UseTLS=YES

Everything else seems to be optional.

Next, create a shell script with the contents
#!/bin/sh
/usr/sbin/ssmtp -au "gmail-address" -ap "password" $@
and put it somewhere in your path (~/bin/gmailout, say) and make it executable (chmod u+x ~/bin/gmailout, I mean) and make sure only you can read it! (chmod og-r ~/bin/gmailout).

Now in ~/.muttrc, put
set pop_host="pops://username:password@pop.gmail.com:995"
set pop_last
unset pop_delete #Just makes mutt not ask, GMail uses config option
set sendmail="~/bin/gmailout"
set write_bcc=no #Important; sSMTP makes bcc non-blind otherwise

and you’re set (remember to make this world-unreadable too: chmod og-rw ~/.muttrc)

You can start mutt, and hit “G” (uppercase G) whenever you want to fetch mail. Can also put exec fetch-mail in ~/.muttrc to have it happen whenever you start mutt, but I find that irritating.

Problems with POP: Not that everything is perfect. I can’t have other mail-transport-agents like sendmail or postfix installed alongside ssmtp. I can’t figure out how to get my crontab reports sent to root, but they do go into ~/dead.letter :D
Also, with mutt I had the habit of adding a my_hdr bcc: my-email-address so that the mail I send is threaded along with the mail I receive (yaay, like Gmail), but somehow there seems to be simply no way of getting Gmail to give me, through POP, those messages I send using an external client. It’s a quirk [bug!] in the way Gmail implements POP. This I’ve fixed by setting mutt’s fcc to /var/mail/my-username, my mail folder. (Of course, if I were in the habit of moving mail to my mbox, I could fcc to mbox too.)
Apart from that, it works fine!

Advertisement

Written by S

Tue, 2007-07-31 at 02:16:03

Cell phone towers

leave a comment »

People who claim to be affected by cellphone towers are apparently delusional.

Meawhile…

Written by S

Sun, 2007-07-29 at 04:48:21

Posted in Uncategorized

Tagged with

Reading random strangers’ blogs

with one comment

I just realised that by over-documenting your life, you might actually be bringing joy to others. Everyone complains that the internet is full of angsty teenagers describing what they had for lunch and dinner on blogs no one reads, but I’ve never understood what the problem is: I simply don’t visit those blogs…

But sometimes random people writing about random things can touch a chord and make one feel all warm and fuzzy inside :-) I don’t even know who Sacha Chua is, but I glance at some of her blog entries just because they’re on Planet Emacsen. And sometimes, such as when she describes how she got reading and brings nostalgia, or trying something fun and writes so well it makes me want to try it myself, I can’t help but decide I ought to at least document the more important bits of my life like—yikes, the report I’m supposed to be working on!

Written by S

Sun, 2007-07-29 at 04:01:03

Posted in Uncategorized

Funky desktop effects

leave a comment »

Because I’m unlikely to actually enable them on my own computer: Here’s what Compiz Fusion can do already!

A couple of those effects might be useless, but it’s all very cool stuff.

Written by S

Sun, 2007-07-29 at 03:29:44

Posted in Uncategorized

Tagged with

Freud

leave a comment »

Seen on Slashdot:

psychology – the study of mind and behavior in relation to a particular field of knowledge or activity

Just because it’s not about you wanting to have sex with your mom doesn’t mean it’s not psychology.

Wow.

And Uncyclopedia makes a similar insightful critique:
MetroFreud

Written by S

Sun, 2007-07-29 at 03:20:40

Posted in funny

Tagged with

Finally we have enough technology to go retro

leave a comment »

Todd Fraser’s web site is cooool! Reload it if you miss it the first time.

It even has an “Open page” feature that offers to open any webpage for you. (Doesn’t seem to work ATM, though.)

The site makes me wonder: Is my reading speed 2400 baud?

Written by S

Sun, 2007-07-29 at 03:07:29

Posted in Uncategorized

A note on procrastination

leave a comment »

I don’t know how long I’ve had this “blog” — it shows archives from November 2005, so I guess at least a year. And in all that time, it has gone by the glorious name of “The title can be changed later, right?“. When I registered the blog and filled in that name, I expected to change it in a few minutes. Took me only a year. Finally it has a name, the title of one of my favourite short stories (borrowed name, but can’t get creative in a year).

Considering that this “blog” is precisely full of potentially interesting trivia that I have decided to “consign to dust and damp by way of preserving them”, I think this will do for now.

Now to get cracking on all the other things I’ve been procrastinating about for years…

[Funny; “All one knew about his skill in shooting was that he could hit a large stag at a ridiculously short range” seems to apply too well…]

Written by S

Sun, 2007-07-29 at 02:51:56

Posted in Uncategorized

Tagged with

“On the internet, nobody knows you’re a dog”

leave a comment »

The popular phrase, and an article about it. The image can be found easily, here for example.

Written by S

Thu, 2007-07-26 at 09:55:07

Posted in entertainment

Tagged with , ,

Harry Potter editions across the pond

leave a comment »

Ugh. But whatever.

The US editions have always had more pages.

The actual differences (wow!) couldn’t possibly contribute anything significant to that difference, either way.

Apparently it’s because they use a bigger font, more whitespace, and have a picture at the beginning of every chapter. (?!)

A source here (Yahoo answers), complete with embarrassingly stupid answers.

Other sources are here and here (same thing), and other possible reasons (generally speaking) include these.

There, now I can close those tabs…

Written by S

Mon, 2007-07-16 at 20:43:44

Posted in entertainment

Tagged with

“expr: syntax error” with acroread

leave a comment »

I installed acroread (BTW it’s called “Adobe Reader”, not “Adobe Acrobat Reader”) on Ubuntu Gutsy from the Medibuntu repository, and running acroread gave lots of

expr: syntax error
expr: syntax error
expr: syntax error
expr: syntax error
expr: syntax error
expr: syntax error
expr: syntax error
expr: syntax error
expr: syntax error
expr: syntax error
expr: syntax error
expr: syntax error
expr: syntax error
expr: syntax error
expr: syntax error
expr: syntax error
expr: syntax error

in an apparent infinite loop.
Googling gave this link but it seemed to already have been fixed in the version I had.

Another link gave the clue:

The line that reads:
echo $mfile| sed ‘s/libgtk-x11-\([0-9]*\).0.so.0.\([0-9]\)00.\([0-9]*\)\|\(.*\)/\1\2\3/g’
should be
echo $mfile| sed ‘s/libgtk-x11-\([0-9]*\).0.so.0.\([0-9]\)000.\([0-9]*\)\|\(.*\)/\1\2\3/g’

The number of 0’s following ‘1’ should match what the real libgtk is: libgtk-x11-2.0.so.0.1000.8

Running locate libgtk-x11 gave

/usr/lib/libgtk-x11-2.0.so.0
/usr/lib/libgtk-x11-2.0.so
/usr/lib/libgtk-x11-2.0.la
/usr/lib/libgtk-x11-2.0.a
/usr/lib/libgtk-x11-2.0.so.0.1105.0
so I removed the 0 on line 421 (not 418) to make it echo $mfile| sed 's/libgtk-x11-\([0-9]*\).0.so.0.\([0-9]*\).\([0-9]*\)\|\(.*\)/\1\2\3/g'
I still don’t understand exactly why it works (the above function would be returning 211050, but it does, and that’s all that matters.

Now to report it on Medibuntu…

Written by S

Sun, 2007-07-08 at 13:26:49

Posted in compknow

Devil’s Pie

leave a comment »

is one of the things that can make GNOME usable. It is the perfect example of what I always meant when I said “GNOME is for advanced users” — to get anything except some set of “basic” things done in GNOME, you need real technical skill, while in KDE you only need patience to look through preference dialogs. And gconf-editor is quite reminiscent of regedit ;-)

Anyway, Devil’s Pie is amazing!

The main page here, a short documentation here, and extensive documentation here. These specs might help.

Two files that I have in my ~/.devilspie contain
(if
(and (is (window_class) "Pidgin") (is (window_role) "conversation"))
(maximize)
)
to make my Pidgin conversation windows maximized, and
(if
(and (is (window_class) "Gnome-terminal") (contains (window_role) "gnome-terminal"))
(maximize)
)
to have my terminal windows maximised.

To make Devilspie run at startup — go to System → Preferences → Sessions and Add it in the “Startup Programs” tab.

One hackish purpose I use Devilspie for is to get around GNOME’s lack of an equivalent of KDE’s “Activate window demanding attention” keybinding. (Ctrl-Alt-A by default)

Because I mainly need this for my Pidgin conversation windows, I have a file pidgin-conversation-focus.ds in ~/.devilspie/special (not in ~/.devilspie) which contains
(if
(and
(is (window_class) "Pidgin")
(is (window_role) "conversation")
(contains (window_name) "(*)")
)
(focus))
and also have a pcf.sh which contains
#!/bin/bash
devilspie ~/.devilspie/special/pidgin-conversation-focus.ds & sleep 1
kill -SIGSTOP $!
in it and is bound to Ctrl-Alt-a (using the painful way GNOME has for assigning keys…)

It sometimes doesn’t work (rather, Pidgin’s message notification plugin doesn’t always insert “(*)” in the title), but I’m getting by.

If there was a way, from within Devilspie, of checking whether a particular window is demanding attention or not, it would be great. I sent a (badly worded) email to the author and haven’t got a reply…

BTW: While testing the above I used
purple-remote "jabber:goim?screenname=myusername@gmail.com&message=hi"
a lot.

Written by S

Sat, 2007-07-07 at 09:13:15

Posted in compknow