GMail, OfflineIMAP & Mutt
OfflineIMAP makes accessing your GMail account with Mutt a breeze. In
this example the offline Maildir directories are put under a
Depending on your GMail filter you might want to add additional
substitutions in the
The last section automatically creates file to be included in your
~/.muttrc, in order to make mutt learn about the Maildir directories
created by OfflineIMAP. So you have to put this line into your
~/.muttrc
pangmail
directory, so you can easily at multiple account
each into their own directory.
This is what goes into you ~/.offlineimaprc
. Please
replace your@gmail.login
with your entire email address.
[general]
accounts = PanGMail
maxsyncaccounts = 3
[Account PanGMail]
localrepository = PanGMailLocal
remoterepository = PanGMailRemote
autorefresh = 10
quick = 5
[Repository PanGMailLocal]
type = Maildir
localfolders = ~/Maildir/pangmail
sep = "/"
[Repository PanGMailRemote]
type = IMAP
remotehost = imap.gmail.com
remoteuser = your@gmail.login
ssl = yes
nametrans = lambda folder: re.sub('.*Spam$', 'spam',
re.sub('.*Drafts$', 'drafts',
re.sub('.*Sent Mail$', 'sent',
re.sub('.*Starred$', 'flagged',
re.sub('.*Trash$', 'trash',
re.sub('.*All Mail$', 'archive', folder))))))
folderfilter = lambda folder: folder not in ['[Gmail]/All Mail',
'[Gmail]/Trash','[Gmail]/Spam','[Gmail]/Starred']
[mbnames]
enabled = yes
filename = ~/.offlineimap.mailboxes
header = "mailboxes "
peritem = "~/Maildir/pangmail/%(foldername)s"
sep = " "
footer = "\n"
nametrans
.
Now fire up OfflineIMAP and watch the mail be pulled in.
% offlineimap
source ~/.offlineimap.mailboxesAs Michael R. Elkins, author of Mutt, might put it: "GMail sucks. With Mutt, it just sucks less."