conf for gmail, lang is not english

Nicolas ml_ask at chirgui.eu
Tue Sep 16 15:41:03 BST 2014


Hello,

I just wanted to let you know that I finally succeeded. I'll post my 
config for those searching the ML in the future :

[general]
accounts = Gmail
maxsyncaccounts = 1
pythonfile = ~/.utf7.py
; from https://gist.github.com/gauteh/5402888

[Account Gmail]
localrepository = Local
remoterepository = Remote

[Repository Remote]
type = Gmail
remoteuser = me at gmail.com
remotepass = P at ssw0rd
sslcacertfile = /etc/ssl/certs/ca-certificates.crt

folderfilter = lambda foldername: foldername not in 
['[Gmail]/Important','[Gmail]/Suivis','[Gmail]/Tous les messages']
nametrans = lambda folder: re.sub('\[Gmail\]/Brouillons', 
'Gmail/drafts',
                            re.sub('INBOX', 'Gmail/inbox',
                            re.sub('\[Gmail\]/Corbeille', 'Gmail/trash',
                            re.sub('\[Gmail\]/Spam', 'Gmail/spam',
                            re.sub('\[Gmail\]/Messages envoyés', 
'Gmail/sent', folder.decode('imap4-utf-7').encode('utf-8'))))))

[Repository Local]
type = IMAP
remotehost = localhost
port = 143
remoteuser = me at example.net
remotepass = P at ssw0rd

folderfilter = lambda foldername: foldername in 
['Gmail/drafts','Gmail/sent','Gmail/trash','Gmail/inbox','Gmail/spam']
nametrans = lambda folder: re.sub('Gmail/drafts', '[Gmail]/Brouillons',
                            re.sub('Gmail/sent', '[Gmail]/Messages 
envoy&AOk-s',
                            re.sub('Gmail/trash', '[Gmail]/Corbeille',
                            re.sub('Gmail/spam', '[Gmail]/Spam',
                            re.sub('Gmail/inbox', 'INBOX', folder )))))

I had first tried in the "Local" to decode/encode just like in remote, 
but that didn't work : I finally chose to use what was seen in the 
--info (Messages envoy&AOk-s).
As I said earlier, in the "remote" part, I couldn't choose to include a 
folder with special characters, so I chose to exclude those I didn't 
want.

This conf will sync everything (selected) from Gmail on my server into 
a subdir.
When I read a new email on my local MUA (webmail), the "seen" flag is 
then synced back to Gmail.
When I delete an email on my MUA, it is also deleted from Gmail (be 
careful !!) (On my setup, it goes to my local "Trash" folder).


Combined with this :
http://www.postfix.org/SASL_README.html#client_sasl

I can now send/receive email on Gmail without logging on the Gmail 
interface, from anywhere (using my own webmail).

/me happy ;)

Thanks to everyone for the help

Nicolas


Le 2014-09-15 17:57, Tomasz Żok a écrit :
> Hi Nicolas,
>
> most probably you did not set "nametrans" rules correctly for your 
> local and
> remote repository.
>
> In my config (also with localized Gmail names for folders) I have:
>
>     [Repository GmailRemote]
>     nametrans = lambda x: 'gmail.INBOX.Sent' if x == 
> '[Gmail]/Wys&AUI-ane'
>
>     [Repository GmailLocal]
>     nametrans = lambda x: '[Gmail]/Wys&AUI-ane' if x == 
> 'gmail.INBOX.Sent'
>
>
> You need to have *exactly opposite* matches in both "nametrans" rules
> for local
> and remote repository. Otherwise, every sync will create new local
> folder which
> will be pushed to remote, so the next sync sees new folder... hence 
> the
> INFINITE FOLDER CREATION problem :)
>
> Hope this helps, best regards,
> Tomasz
>
>
> On 2014-09-15 at 17:39, Nicolas wrote:
>> Ok, I went one more step ahead, but encounter a new issue, which 
>> raised a
>> new question :
>>
>> Here is how I "solved" my problem until now :
>> [Repository Remote]
>> type = Gmail
>> ...
>> folderfilter = lambda foldername: foldername not in
>> ['[Gmail]/Important','[Gmail]/Spam','[Gmail]/Suivis','[Gmail]/Tous 
>> les
>> messages']
>> nametrans = lambda folder: re.sub('\[Gmail\]/Brouillons', 
>> 'Gmail/drafts',
>>                            re.sub('INBOX', 'Gmail/inbox',
>>                            re.sub('\[Gmail\]/Corbeille', 
>> 'Gmail/trash',
>>                            re.sub('\[Gmail\]/Messages envoyés',
>> 'Gmail/sent', folder.decode('imap4-utf-7').encode('utf-8')))))
>> I've been the other way around : instead of selecting what I wanted, 
>> I
>> excluded what I did not want....
>> Also added some code found somewhere for utf-8/imap4-utf-7, then :
>>
>> [Repository Local]
>> type = IMAP
>> folderfilter = lambda foldername: foldername in
>> ['Gmail/drafts','Gmail/sent','Gmail/trash','Gmail/inbox']
>> nametrans = lambda folder: re.sub('Gmail/drafts$', 
>> '\[Gmail\]/Brouillons',
>>                            re.sub('Gmail/inbox$', 
>> '\[Gmail\]/Messages
>> envoyés',
>>                            re.sub('Gmail/trash$', 
>> '\[Gmail\]/Corbeille',
>>                            re.sub('Gmail/inbox$', 'INBOX',
>> folder.decode('utf-8').encode('imap4-utf-7')))))
>>
>> The goal of this 2nd part is to sync the flags changed on the local 
>> side
>> synced to the remote side : If I read Gmail on my local MUA, I want 
>> the
>> "seen" flag to be also added on Gmail interface.
>>
>> BUT ...
>> When I run offlineimap for the 1st time, all is OK, it sync the 
>> right folder
>> from gmail on my local server. When I want to run it a 2nd time, I 
>> get the
>> error "INFINITE FOLDER CREATION DETECTED" and I do not understand 
>> exactly
>> the message/why/how/what...
>>
>> This brought me an other question : If I (accidentally) delete the 
>> local
>> gmail folders : (in my desired setup : ) it should delete everything 
>> on
>> gmail, right ??
>>
>> To sum up, 2 questions :
>> - How to get rid of the "INFINITE FOLDER CREATION DETECTED" error ?
>> - Is it possible to sync the flag, the email moves, but not the 
>> delete of
>> everything ?
>>
>> Thanks for yous help, and sorry for the noise...
>>
>> Regards
>> Nicolas
>>
>>
>>
>> Le 2014-09-15 11:16, Nicolas a écrit :
>> >Hi,
>> >
>> >OK, I'm going a bit further.
>> >
>> >I've now decided to sync the Inbox, and the Sent/Drafts/Trash 
>> folders.
>> >
>> >I have troube with the french characters in "Messages envoyés" 
>> (Sent)
>> >: it appears as "[Gmail]/Messages envoy&AOk-s", but when trying to
>> >include it in the folderlist, it appears "disabled" when running 
>> with
>> >--info. I tried "Messages envoyés", "Messages envoy?s", "Messages
>> >envoy\&AOk-s"...
>> >
>> >Any idea ?
>> >
>> >See the conf and the logfile :
>> >
>> >
>> >[general]
>> >accounts = Gmail
>> >maxsyncaccounts = 1
>> >
>> >[Account Gmail]
>> >localrepository = Local
>> >remoterepository = Remote
>> >
>> >[Repository Remote]
>> >type = Gmail
>> >remoteuser = me at gmail.com
>> >remotepass = P at ssw0rd
>> >sslcacertfile = /etc/ssl/certs/ca-certificates.crt
>> >
>> >folderfilter = lambda foldername: foldername in
>> >['[Gmail]/Brouillons','[Gmail]/Messages
>> >envoy\?s','[Gmail]/Corbeille','INBOX']
>> >nametrans = lambda folder: re.sub('[Gmail]/Brouillons',
>> >'Gmail/Brouillons',
>> >                           re.sub('[Gmail]/Messages envoy\?s',
>> >'Gmail/Sent',
>> >                           re.sub('[Gmail]/Corbeille', 
>> 'Gmail/Corbeille',
>> >                           re.sub('INBOX', 'Gmail/INBOX', 
>> folder))))
>> >
>> >
>> >[Repository Local]
>> >type = IMAP
>> >remotehost = localhost
>> >port = 143
>> >remoteuser = me at example.net
>> >remotepass = P at ssw0rd
>> >
>> >folderfilter = lambda foldername: foldername in
>> >['Gmail/Brouillons','Gmail/Sent','Gmail/Corbeille','Gmail/INBOX']
>> >nametrans = lambda folder: re.sub('Gmail/Brouillons$',
>> >'[Gmail]/Brouillons',
>> >                           re.sub('Gmail/Sent$', '[Gmail]/Messages
>> >envoy\?s',
>> >                           re.sub('Gmail/Corbeille$', 
>> '[Gmail]/Corbeille',
>> >                           re.sub('Gmail/INBOX$', 'INBOX', 
>> folder))))
>> >
>> >
>> >
>> >$ offlineimap --dry-run --info
>> >OfflineIMAP 6.5.4
>> >  Licensed under the GNU GPL v2+ (v2 or any later version)
>> >Remote repository 'Remote': type 'Gmail'
>> >Host: imap.gmail.com Port: 993 SSL: 1
>> >Establishing connection to imap.gmail.com:993
>> >Server supports ID extension.
>> >Server welcome string: * OK Gimap ready for requests from
>> >dead:beef:8:d73d::1 nc20mb33560599wic
>> >Server capabilities: ('IMAP4REV1', 'UNSELECT', 'IDLE', 'NAMESPACE',
>> >'QUOTA', 'ID', 'XLIST', 'CHILDREN', 'X-GM-EXT-1', 'UIDPLUS',
>> >'COMPRESS=DEFLATE', 'ENABLE', 'MOVE', 'CONDSTORE', 'ESEARCH')
>> >
>> >folderfilter= lambda foldername: foldername in
>> >['[Gmail]/Brouillons','[Gmail]/Messages
>> >envoy\?s','[Gmail]/Corbeille','INBOX']
>> >
>> >nametrans= lambda folder: re.sub('[Gmail]/Brouillons', 
>> 'Gmail/Brouillons',
>> >re.sub('[Gmail]/Messages envoy\?s', 'Gmail/Sent',
>> >re.sub('[Gmail]/Corbeille', 'Gmail/Corbeille',
>> >re.sub('INBOX', 'Gmail/INBOX', folder))))
>> >
>> >Folderlist:
>> > [Gmail]/Brouillons
>> > [Gmail]/Corbeille
>> > [Gmail]/Important (disabled)
>> > [Gmail]/Messages envoy&AOk-s (disabled)
>> > [Gmail]/Spam (disabled)
>> > [Gmail]/Suivis (disabled)
>> > [Gmail]/Tous les messages (disabled)
>> > INBOX -> Gmail/INBOX
>> >
>> >Local repository 'Local': type 'MappedIMAP'
>> >Host: localhost Port: None SSL: 0
>> >Establishing connection to localhost:143
>> >Server supports ID extension.
>> >Server welcome string: * OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR
>> >LOGIN-REFERRALS ID ENABLE IDLE STARTTLS AUTH=PLAIN] Dovecot ready.
>> >Server capabilities: ('IMAP4REV1', 'LITERAL+', 'SASL-IR',
>> >'LOGIN-REFERRALS', 'ID', 'ENABLE', 'IDLE', 'SORT', 'SORT=DISPLAY',
>> >'THREAD=REFERENCES', 'THREAD=REFS', 'MULTIAPPEND', 'UNSELECT',
>> >'CHILDREN', 'NAMESPACE', 'UIDPLUS', 'LIST-EXTENDED', 'I18NLEVEL=1',
>> >'CONDSTORE', 'QRESYNC', 'ESEARCH', 'ESORT', 'SEARCHRES', 'WITHIN',
>> >'CONTEXT=SEARCH', 'LIST-STATUS', 'SPECIAL-USE')
>> >
>> >folderfilter= lambda foldername: foldername in
>> >['Gmail/Brouillons','Gmail/Sent','Gmail/Corbeille','Gmail/INBOX']
>> >
>> >nametrans= lambda folder: re.sub('Gmail/Brouillons$',
>> >'[Gmail]/Brouillons',
>> >re.sub('Gmail/Sent$', '[Gmail]/Messages envoy\?s',
>> >re.sub('Gmail/Corbeille$', '[Gmail]/Corbeille',
>> >re.sub('Gmail/INBOX$', 'INBOX', folder))))
>> >
>> >Folderlist:
>> > Drafts (disabled)
>> > INBOX (disabled)
>> > ML (disabled)
>> > ML/debian (disabled)
>> > ML/FRnOG (disabled)
>> > ML/FRsAG (disabled)
>> > ML/ml_ask (disabled)
>> > Queue (disabled)
>> > Sent (disabled)
>> > Trash (disabled)
>> >
>> >Regards
>> >Nicolas
>> >
>> >
>> >On Sun, 14 Sep 2014 10:35:08 +0200, Tomasz Żok wrote:
>> >
>> >>
>> >>From the last time I checked it, you could not change existing
>> >>e-mails in the "[Gmail]/All mail" folder. This includes setting 
>> the
>> >>"seen" flag (i.e. marking the message as read) which is the 
>> subject
>> >>of the original question from Nicolas.
>> >
>> >>
>> >>Best regards,
>> >>Tomasz
>>
>>
>> _______________________________________________
>> OfflineIMAP-project mailing list
>> OfflineIMAP-project at lists.alioth.debian.org
>> 
>> http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/offlineimap-project
>>
>> OfflineIMAP homepage: http://software.complete.org/offlineimap





More information about the OfflineIMAP-project mailing list