Syncing creates new [Imap]/Bin label for filtered messages

Mateusz Loskot mateusz at
Sun Feb 24 14:10:12 GMT 2019


I've just started using offlineimap for the first time.
I'm very thankful to Eric Wong from who
recommended me the offlineimap - it is fantastically useful
piece of software, a wonder for someone who is trying to
restore e-mail sanity after of being chained to GMail Web UI.

So, I've managed to install the latest offlineimap (using pip on Debian 9)
and configure it for my GMail account using OAuth2.

I noticed one issue which I don't quite understand.

On my GMail, I have two basic filters configured:
 - If subject contains ABC, delete it.

This seems to cause offlineimap to create new label: [Imap]/Bin
and label with it all messages that match the filters.
IOW, those messages do not go to GMails Bin.

Here is my config:

$ cat .offlineimaprc
accounts = Gmail
maxsyncaccounts = 1

[Account Gmail]
localrepository = Local
remoterepository = Remote

[Repository Local]
type = GmailMaildir
localfolders = ~/Mail/Gmail
## Remove GMAIL prefix on Google-specific IMAP folders that are pulled down.
nametrans = lambda f: '[Gmail]/' + f if f in ['Drafts', 'Starred',
'Important', 'Spam', 'Trash', 'All Mail', 'Sent Mail'] else f

[Repository Remote]
type = Gmail
remoteuser = mateusz at
auth_mechanisms = XOAUTH2
oauth2_client_id = SECRET_CLIENT_ID
oauth2_client_secret = SECRET_CLIENT_SECRET
oauth2_request_url =
oauth2_refresh_token = SECRET_REFRESH_TOKEN
## remove Gmail prefix on IMAP folders
nametrans = lambda f: f.replace('[Gmail]/', '') if
f.startswith('[Gmail]/') else f
sslcacertfile = /etc/ssl/certs/ca-certificates.crt

Am I missing anything in the config?
Since there is no Trash in GMail via Wet UI,
does it mean the nametrans function above should also include 'Bin'?

BTW, when creating the config, I followed these two:

Best regards,
Mateusz Loskot,

More information about the OfflineIMAP-project mailing list