So my offlineimap.conf looks like this:
[general]
accounts = Gmail-raub
[Account Gmail-raub]
localrepository = Gmaillocal-mine
remoterepository = Gmailserver-mine
synclabels = yes
# This header is where labels go. Usually you will be fine
# with default value (X-Keywords), but in case you want it
# different, here we go:
labelsheader = X-Keywords
[Repository Gmailserver-mine]
#This is the remote repository
type = Gmail
ssl = yes
remotepass = super-sercret-password
remoteuser = my-account@gmail.com
sslcacertfile = /etc/ssl/certs/ca-bundle.crt
ssl_version = tls1_2
folderfilter = lambda folder: folder in ('[Gmail]/Drafts')
[Repository Gmaillocal-mine]
#This is the 'local' repository
# type = Maildir
type = GmailMaildir
localfolders = ~/mail/gmail_offlineimap
With the above settings I am able to download Drafts, but if I replace [Gmail]/Drafts folderfilter entry with the [Gmail]/Inbox, it starts as usual
offlineimap -d imap -c offlineimap.conf
OfflineIMAP 6.7.0
Licensed under the GNU GPL v2 or any later version (with an OpenSSL exception)
Debug mode: Forcing to singlethreaded.
Now debugging for imap: IMAP protocol debugging
Now debugging for : Other offlineimap related sync messages
Account sync Gmail-raub:
[imap]: Using authentication mechanisms ['GSSAPI', 'XOAUTH2', 'CRAM-MD5', 'PLAI
N', 'LOGIN']
*** Processing account Gmail-raub
Establishing connection to imap.gmail.com:993
[imap]: 39:53.12 Account sync Gmail-raub imaplib2 version 2.52
[imap]: 39:53.12 Account sync Gmail-raub imaplib2 debug level 5, buffer level
3
and then authenticates and lists all the different mail folders I have. And then filter them all out because of my folderfilter setting. But then it just closes the connection:
[...]
[imap]: 35:06.22 Account sync Gmail-raub state => LOGOUT
[imap]: 35:06.22 Account sync Gmail-raub [sync] LOGOUT ()
[imap]: 35:06.22 Account sync Gmail-raub state_change_pending.acquire
[imap]: 35:06.22 Account sync Gmail-raub _request_push(IDEE11, LOGOUT, {}) = IDEE11
[imap]: 35:06.22 Account sync Gmail-raub data=IDEE11 LOGOUT
imap.gmail.com writer:
[imap]: 35:06.22 imap.gmail.com writer > IDEE11 LOGOUT\r\n
Account sync Gmail-raub:
[imap]: 35:06.22 Account sync Gmail-raub LOGOUT:IDEE11.ready.wait
imap.gmail.com reader:
[imap]: 35:06.29 imap.gmail.com reader poll => [(4, 1)]
[imap]: 35:06.29 imap.gmail.com reader rcvd 57
[imap]: 35:06.29 imap.gmail.com reader < * BYE LOGOUT Requested\r\n
[imap]: 35:06.29 imap.gmail.com reader < IDEE11 OK 73 good day (Success)\r\n
imap.gmail.com handler:
[imap]: 35:06.29 imap.gmail.com handler _put_response(* BYE LOGOUT Requested)
[imap]: 35:06.29 imap.gmail.com handler untagged_responses[BYE] 0 += ["LOGOUT Requested"]
[imap]: 35:06.29 imap.gmail.com handler BYE response: LOGOUT Requested
[imap]: 35:06.29 imap.gmail.com handler terminating: 'connection terminated'
[imap]: 35:06.29 imap.gmail.com handler LOGOUT:IDEE11.ready.set
imap.gmail.com writer:
[imap]: 35:06.29 imap.gmail.com writer finished
imap.gmail.com handler:
[imap]: 35:06.29 imap.gmail.com handler state_change_free.set
[imap]: 35:06.29 imap.gmail.com handler finished
imap.gmail.com reader:
[imap]: 35:06.30 imap.gmail.com reader poll => [(4, 1)]
[imap]: 35:06.30 imap.gmail.com reader rcvd 0
Account sync Gmail-raub:
[imap]: 35:06.34 Account sync Gmail-raub ["<class 'offlineimap.imaplib2.abort'>: command: LOGOUT => connection terminated"]
[imap]: 35:06.34 Account sync Gmail-raub _close_threads
[imap]: 35:06.34 Account sync Gmail-raub call shutdown
imap.gmail.com reader:
[imap]: 35:06.40 imap.gmail.com reader finished
Account sync Gmail-raub:
[imap]: 35:06.40 Account sync Gmail-raub state_change_pending.release
[imap]: 35:06.40 Account sync Gmail-raub connection closed
[imap]: 35:06.40 Account sync Gmail-raub _get_untagged_response(BYE) => ['LOGOUT Requested']
*** Finished account 'Gmail-raub' in 0:01
Why did it terminate the connection? Does it not like [Gmail]/Inbox? I also tried
# folderfilter = lambda folder: folder in ('[Gmail]/INBOX')
# folderfilter = lambda folder: folder in ('INBOX')
and either of them result in a different (but the same between them) error:
ERROR: getfolder() asked for a nonexisting folder 'INBOX'.