You are not logged in.
Hello,
I am trying to configure my email environment. There are many guides, but unfortunately I must have missed something. offlineimap deleted the whole content of my INBOX on my main email account, I don't know why this happened. Before I continue fiddling around I better ask some basics here.
What happens if I sync my local and remote repos, and then content on my remote repo gets deleted from another program. Now if I run offlineimap again, will the missing items be restored as they are still present on my local repo? Maybe I should sync only in one direction? But then what happens if I delete something on my local repo, how will it get deleted on my remote repo, too?
And trying to understand why I lost everything from my INBOX, if my local repo is empty at first, and then I do a sync, could this have deleted everything on my remote repo?
I'll post my config here, just in case:
[general]
accounts = gmail, gmx, strato, uberspace, yahoo
maxsyncaccounts = 5
socktimeout = 60
ui = Quiet
[mbnames]
enabled = yes
filename = ~/.mutt/mailboxes
header = "mailboxes "
peritem = "+%(accountname)s/%(foldername)s"
sep = " "
footer = "\n"
[Account gmail]
localrepository = gmail-local
remoterepository = gmail-remote
status_backend = sqlite
[Repository gmail-local]
type = Maildir
localfolders = ~/mail/gmail
nametrans = lambda folder: re.sub('^inbox$', 'INBOX',
re.sub('^drafts$', '\[Google Mail\].Drafts',
re.sub('^sent$', '\[Google Mail\].Sent Mail',
re.sub('^trash$', '\[Google Mail\].Trash',
re.sub('^spam$', '\[Google Mail\].Spam',
re.sub('^junk$', 'Junk E-mail', folder))))))
[Repository gmail-remote]
type = Gmail
maxconnections = 2
createfolders = False
ssl = yes
sslcacertfile = /etc/ssl/certs/ca-certificates.crt
remotehost = imap.gmail.com
remoteport = 993
remoteuser = myuser
remotepass = mypass
nametrans = lambda folder: re.sub('^INBOX$', 'inbox',
re.sub('^\[Google Mail\].Drafts$', 'drafts',
re.sub('^\[Google Mail\].Sent Mail$', 'sent',
re.sub('^\[Google Mail\].Trash$', 'trash',
re.sub('^\[Google Mail\].Spam$', 'spam',
re.sub('^Junk E-mail$', 'junk', folder))))))Only showing my gmail settings, for my other accounts they are similar. Is there something wrong with my nametrans? I don't know, this way it seems logic to me. The createfolders=False I just put because I got an error earlier:
ERROR: INFINITE FOLDER CREATION DETECTED! Folder 'spam' (repository 'gmail-local') would be created as folder '\[Google Mail\]/Spam' (repository 'gmail-remote'). The latter becomes '\[Google Mail\].Spam' in return, leading to infinite folder creation cycles.Last edited by hddnhrst (2013-09-05 19:04:10)
Offline
If you want more control of what gets synced in each direction and the ability to very easily determine the master and slave of the setup, i would recommend mbsync (isync). I had been suing offlineimap for quite some time, and just switched to mbsync the other day. It is far more configurable, yet at its most basic it is actually much easier to configure. It is also written in C apparently and seems to put a whole hell of a lot less strain on my system during syncs.
The only downside is that it cannot be run as a daemon (yet?) like offlineimap. But offlineimap in daemon mode opened up ~100 threads and what vastly ineffiecient on my machine. I guess this is directly related to the number of mails you have though. So since you now have zero maybe it will be efficient ![]()
Offline
I unfortunately can't answer why you lost your inbox on initial sync. If you delete an email from Gmail's web interface, it will get deleted from your local repository on next sync and vice versa. That's part of why it's so convenient! For reference, here's my .offlineimaprc:
[general]
metadata = ~/.offlineimap
accounts = firecat53
maxsyncaccounts = 2
ui = quiet
fsync = false
ignore-readonly = no
[Account firecat53]
localrepository = firecat53_local
remoterepository = firecat53_remote
autorefresh = 0
status_backend = sqlite
[Repository firecat53_local]
type = Maildir
localfolders = ~/mail/primaryaccount
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('archive', '[Gmail].All Mail', folder))))))
[Repository firecat53_remote]
type = Gmail
ssl = yes
sslcacertfile = /etc/ssl/certs/ca-certificates.crt
remoteuser = primaryaccount@gmail.com
remotepass = password
realdelete = no
maxconnections = 5
folderfilter = lambda folder: "important" not in folder.lower()
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('.*All Mail$', 'archive', folder))))))I run offlineimap from cron (not in daemon mode) every 2 minutes using the -f flag and only syncing my inbox and news (I use rss2email) folders. Then every 15 minutes I run a full sync. The inbox/news folders sync only takes a second or two. You can make it even faster using the '-q' flag.
*/2 * * * * ID=offlineimap_inbox /usr/bin/offlineimap -f INBOX,News &> /dev/null
*/15 * * * * ID=offlineimap /usr/bin/offlineimap &> /dev/nullIf something gets corrupted it's typically ok to delete the contents of ~/.offlineimap and re-run it to regenerate the repository information (someone please slap me if I'm way wrong...but I believe I did it not too long ago and didn't have any issues).
Scott
Offline
If you delete, inadvertently obviously, your local maildirs, then offlineimap will remove everything on the remote server (or try to, in the case of GMail, you will still have the All Mail folder, or whatever it is called). I suspect, but haven't bothered to confirm, that this is is because of the absence of any dir structure.
You can push back to the IMAP server from a backup (which, you have, no doubt
) with isync.
Offline
Yeah backups... *cough* sure have! ![]()
The nametrans in my above config is wrong. The 2nd argument of re.sub is not a regex, so no escaping the square brackets on the local repo. The error of infinite folder creation disappeared, although I am not sure what was the reason. It's confusing when to use '.' or '/' for separator. Maybe it's safer to use an explcit "sep=." like firecat53 does.
I am using cronjobs, too. Every 5 minutes a quick sync and a full sync every hour. Seems to work now.
Thanks guys... solved for me.
Offline