Gmail and GMX with Getmail and Mutt

I’ve recently gotten a gmx account – mostly to keep a separate “professional” email address. Like gmail, gmx gives you IMAP access, so I can use it with my favorite mail client mutt. This is about the two (minor) snags that I ran into getting mutt to receive mail from both accounts.

The first gotcha has to do with … well, actually I’m not too sure what was causing it. I first tried the obvious, which was to go into my getmail (I use getmail as my MTA, by the way) rc file and copy the “receiver” block, changing all the fields so that they would be relevant to gmx. See if you can spot the differences. Here’s the original (gmail) setup:


[retriever]
type = SimpleIMAPSSLRetriever
server = imap.gmail.com
username = gmailusername
password = gmailpassword
mailboxes = ("INBOX", )

And here’s the gmx setup:


[retriever]
type = SimpleIMAPSSLRetriever
server = imap.gmx.com
username = gmxusername@gmx.com
password = gmxpassword
mailboxes = ("INBOX", )

Yup, it’s the username. No clue why, but gmx wants you to include the full domain name after your username. I can only imagine that under the covers getmail rewrites all this to gmxusername@gmx.com@imap.gmx.com, since its default behavior, if the gmail snippet is any guide, is to append and at sign and the server name to the user name. Well, howerver gmx wants it done, I guess. I stumbled accross the answer just by noticing that this guy had his set up that way.

The second gotcha isn’t really a gotcha so much as a “sigh … wish getmail had included the ability to specify more than one account in the same rc file.” But actually, I guess they have their reasons. Anyway, bottom line, as it says clearly on the FAQ if you take the time to read it, is that getmail can’t do more than one account at a time. So what’s a guy to do?

Solution: do it through mutt. There’s a command-line flag to have getmail switch rc files: --rcfile filename. The manual makes it look like you have to specify a path, but getmail seems to know where its home directory is, so if you just put it in /Users/you/.getmail (Mac OS users) it should find it. In my .muttrc file I changed my mapped-in getmail command to the following:


macro index G " getmail --rcfile getmailrc --rcfile gmxrcr"

And now it uses both. Which is to say, when I hit “SHIFT-G” in mutt, it gets mail from both accounts. Obviously it’s easy to map further keys that do only one or the other.

Anyway, that’s that. GMX mail is being delivered to my computer free of charge and with no hassle.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>