You are not logged in.

#1 2012-05-30 14:52:23

asd01
Member
Registered: 2010-12-19
Posts: 19

[SOLVED] offlineimap + gmail and nametrans rule

As OfflineImap supports the creation of folders on the remote repository now I trying to adopt my set-up to reflect that. I got offlineimap + gmail mostly working, only problem I still have is the gmail's All Mail folder - I can't figure out how to translate its name in both directions. Here is my config:

[general]
metadata = ~/.config/offlineimap
accounts = gmail
maxsyncaccounts = 2
ui = ttyui

[Account gmail]
localrepository = gmail_local
remoterepository = gmail_remote
status_backend = sqlite

[Repository gmail_local]
type = Maildir
localfolders = ~/mail/gmail
sep = .
nametrans = lambda folder: re.sub('spam', '[Google Mail].Spam',
                           re.sub('drafts', '[Google Mail].Drafts',
                           re.sub('sent', '[Google Mail].Sent Mail',
                           re.sub('bin', '[Google Mail].Bin',
                           re.sub('archive', '[Google Mail].All Mail', folder)))))

[Repository gmail_remote]
type = Gmail
ssl = yes
remoteuser =
remotepass =
maxconnections = 5
nametrans = lambda folder: re.sub('.*Spam$', 'spam',
                           re.sub('.*Drafts$', 'drafts',
                           re.sub('.*Sent Mail$', 'sent',
                           re.sub('.*Bin$', 'bin',
                           re.sub('.*All Mail$', 'archive', folder)))))

Unfortunately, with the above config All Mail doesn't want to sync at all. Any idea how I can fix that?

Last edited by asd01 (2012-06-07 13:06:05)

Offline

#2 2012-05-31 12:49:13

enr1x
Member
From: Girona, Spain
Registered: 2006-11-09
Posts: 29

Re: [SOLVED] offlineimap + gmail and nametrans rule

I am having a similar problem, but I am trying to solve it now...

Last edited by enr1x (2012-05-31 12:55:29)

Offline

#3 2012-06-03 16:29:01

Khayyam
Member
Registered: 2012-03-08
Posts: 1

Re: [SOLVED] offlineimap + gmail and nametrans rule

asd01 ...

The documentation and config examples seems to be somewhat askew in regard to reverse-nametrans, though a "warning" is given in the docs, the example config files only provide 'remote' nametrans, with no suggestion that the 'reverse' is required. This may be an oversight, but they have been updated in other regards (such as the need to encoded '%' as '%%').

So, 'warnings' aside, I'm using 6.5.4 (self maintained ebuild, yes Gentoo, not Arch) and I only provide the 'remote' nametrans and have no problem sync'ing both ways.

The relevant sections from my config:

folderfilter = lambda foldername: foldername in ['INBOX', '[Gmail]/Drafts','[Gmail]/Sent']
nametrans = lambda foldername: foldername.replace("[Gmail]/","")

This pulls only 'INBOX, 'Drafts' and 'Sent' folders, and strips off the "[Gmail]" prefix for 'local' folders, again I sync in both directions and have yet to see anything that suggests the local and remote are not in sync.

In your case you might try using 'folderincludes =' for folder creation (on remote), and something similar to the above for the 'standard' folders you want sync'ed, ie '[Gmail].All', but only under the 'remote' section.

My gmail account is just a spam trap and so I'm not really worried if it all goes to hell, on my main mail account I've no need to translate so I can only say it works in regard to Gmail.

It might be worth querying the author in the regard, there are other sections of the documentation (like the CACert creation) which are simply wrong, so, I would say, go with what works ..

HTH in some way ...

best .. khayyam

Offline

#4 2012-06-03 17:14:16

firecat53
Member
From: Lake Stevens, WA, USA
Registered: 2007-05-14
Posts: 1,542
Website

Re: [SOLVED] offlineimap + gmail and nametrans rule

Here's mine:

[Account firecat]
localrepository = firecat_local
remoterepository = firecat_remote
autorefresh = 0
status_backend = sqlite

[Repository firecat_local]
type = Maildir
localfolders = ~/mail/firecat
sep = .
restoreatime = no
maxconnections = 5
nametrans = lambda folder: re.sub('spam', '[Gmail].Spam',
                           re.sub('drafts', '[Gmail].Drafts',
                           re.sub('sent', '[Gmail].Sent Mail',
                           re.sub('flagged', '[Gmail].Starred',
                           re.sub('trash', '[Gmail].Trash',
                           re.sub('important', '[Gmail].Important',
                           re.sub('archive', '[Gmail].All Mail', folder)))))))

[Repository firecat_remote]
type = Gmail
ssl = yes
remoteuser = email@gmail.com
remotepass = password
realdelete = no
maxconnections = 5
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('.*Important$', 'important', 
                           re.sub('.*All Mail$', 'archive', folder)))))))

Hope that helps. Working for a long time now, bidirectional syncing.

Scott

Offline

#5 2012-06-06 19:19:51

asd01
Member
Registered: 2010-12-19
Posts: 19

Re: [SOLVED] offlineimap + gmail and nametrans rule

Khayyam and firecat53 - thanks for suggestions, unfortunately the 'All Mail' problem persists.

Offline

#6 2012-06-06 22:25:32

a_neutrino
Member
From: Montreal, Canada
Registered: 2010-03-14
Posts: 50
Website

Re: [SOLVED] offlineimap + gmail and nametrans rule

I use 龍神's script:
Get offlineimap working with non ASCII characters.

Works for any non-ascii characters. Following a recent update on offlineimap, it is necessary to specify the reverse nametrans in the  local repository configuration :

nametrans = lambda foldername: foldername.decode('utf-8').encode('imap4-utf-7')

I sent a comment about it to his blog but he hasn't posted it yet.

Offline

#7 2012-06-07 13:05:42

asd01
Member
Registered: 2010-12-19
Posts: 19

Re: [SOLVED] offlineimap + gmail and nametrans rule

Solved... I completely forgot about checking the gmail settings - I wasn't subscribed to the 'All Mail' folder there... (facepalm)

Offline

Board footer

Powered by FluxBB