OfflineIMAP and Mutt with Gmail's All Mail fol

2019-05-28 12:53发布

问题:

OfflimeIMAP

I am trying to sync my Gmail - All Mail folder with idlefolders through offlineimap. My .offlineimaprc config has this -

idlefolders = ['INBOX', '[Gmail].All Mail']

My name of my All Mail folder in .mail (where my mailboxes are) looks like

drwx------ 5 ry ry    4096 Oct 12 18:13 [Gmail].All Mail

I think the name is wrong in idlefolders. I see a lot of people online using [Gmail]/All Mail.

My INBOX folder sync fine but All Mail does not.

MUTT

Also trying to set a macro shortcut to All Mail in .muttrc I have -

macro index ga  "<change-folder> =[Gmail].All Mail<enter>"

This does not work, but my macro for INBOX does work

macro index gi  "<change-folder> =INBOX<enter>"

What's wrong? How should I call my All Mail folder?

回答1:

I think the problem here is the whitespace in the folder. Possible solutions:

  1. Update: As winchendonsprings pointed out, there is a way to escape the whitespace in the folder name. Now we can use a macro to change to All Mail:

    bind editor <space> noop
    macro index ga "<change-folder>=[Gmail].All Mail<enter>" "Go to all mail"
    
  2. You use a name transalation to create mailboxes without a whitespace as described in the documentation. For example the translation could look like this:

    nametrans = lambda x: re.sub('\[|\]|\s', '_', x)
    

    You should make sure, as the documentation states, that no folder ends up with the same translated name. You can check this by running offlineimap with --info.

  3. Another possible solution could be, to register your mailboxes and simply use a macro to toggle between the index and your list of configured mailboxes, eg. in your .muttrc:

    mailboxes =[Gmail].All\ Mail =[Gmail].Important =[Gmail].Starred
    macro index <left> ':mailboxes <enter>c?<toggle-mailboxes>
    

    That provides the benefit that mutt monitors your local mailbox and tells you if you've got new mail. You can even automate this if you want. Examples can be found here.



回答2:

for my Mutt 1.5.21, percent encoding works:

macro index ga "<change-folder>=[Gmail]/All%20Mail<enter>"


回答3:

Another terrible solution is to just use <complete> to avoid typing a literal space:

macro index ga "<change-folder>=[Gmail]/All<complete><enter>"


标签: gmail imap mutt