Setting up a MRA (fetchmail/getmail) to pull all folders from Gmail over POP/IMAP

Sriram Krishnan picture Sriram Krishnan · Aug 19, 2009 · Viewed 7.4k times · Source

I would like to setup fetchmail or getmail to pull email from Gmail. I would prefer it to be IMAP but I can live with POP as well. The issue I'm running into is that all these seem to want you to specify the exact list of folders you want checked (this is cleaner in IMAP than POP).

This is a hassle since I frequently change my list of folders and when I do, I don't want to have to change my configuration file to add/remove folders. When something changes, I automatically want a mbox or a maildir directory to 'show up' with the contents of my new folder. I would also prefer the mbox to have the same name as the folder on the server

The closest thing I could find was the -r option in fetchmail but that doesn't seem to do this either. I'm sure I must be missing something since every email client is able to do this and I'm hoping that that functionality lives inside the MRA and not in the MUA.

Update: I'd like to move this thread to Serverfault and I'm ok with voting to close this and migrate. Unfortunately, I dont have the rep to do it myself yet

Answer

neuro picture neuro · Aug 22, 2009

With getmail you can use the following line in your configuration to get all your mail :

mailboxes = ("[Google Mail]/All Mail",)

With IMAP you can list the folders on the server, that way email clients can do whatever they need. In getmail it depends on how the email retrievers are written. If this configuration does not work, you can check the IMAP retriever code and write a specific one that suits your needs ;-)

my 2 cents

PS: I have no getmail installation to check if that do the trick ...