Can offlineimap do a one-way sync?

7

5

I love the free webmail services out there but hate having years of mail tied up in one of these products.

I'm looking for a way to cache a mailbox locally but still be able to access it from a locally installed imap client.

I looked at offlineimap, which looks great except its doing a two-way sync. If mail gets deleted in gmail, it will also delete it in my local copy. There doesn't appear to be a way to configure it to do something that looks more like traditional pop access where the new message is copied locally and deleted from the remote source.

Has anyone done something like this before? I'm not tied to imap. If there is a pop based solution out there, I'm all ears. I'm using ubuntu 11.10.

txyoji

Posted 2011-12-04T14:17:30.180

Reputation: 2 992

Answers

4

The current behavior you describe is called "one-way sync" – all changes in one side, including deletion, are propagated to the other side.

For a permanent cache, look into getmail or fetchmail.

# ~/.getmail/getmailrc
[retriever]
  type = SimpleIMAPSSLRetriever
  server = imap.gmail.com
  username = ...
  password = ...
[destination]
  type = Maildir
  path = ~/backup/gmail

Both these programs support fetching from IMAP and POP3 mailboxes, but IMAP is usually preferred.

user1686

Posted 2011-12-04T14:17:30.180

Reputation: 283 655

12

OfflineIMAP does support one-way sync (no updates to the actual mail server's mailbox), using the readonly = True option. See the sample configuration file in the official GitHub repository.

So your .offlineimap config file should contain:

[Repository Gmailserver-foo]
#This is the remote repository
type = Gmail
remotepass = XXX
remoteuser = XXX
readonly = true

Leafy

Posted 2011-12-04T14:17:30.180

Reputation: 121

3

this is my configuration file used to do one-way-sync from one gmail account to another

[general]
accounts = GmailMigration
socktimeout = 600
maxsize = 25000000

[Account GmailMigration]
localrepository = sourceAccount
remoterepository = dstAccount

[Repository sourceAccount]
type = IMAP
remotehost = imap.gmail.com
remoteport = 993
remoteuser = ...
remotepass = ...
ssl = yes
sslcacertfile = /etc/ssl/certs/ca-certificates.crt
readonly = true

[Repository dstAccount]
type = IMAP
remotehost = imap.gmail.com
remoteport = 993
remoteuser = ...
remotepass = ...
ssl = yes
sslcacertfile = /etc/ssl/certs/ca-certificates.crt

pelotasplus

Posted 2011-12-04T14:17:30.180

Reputation: 131

1

Basically you want is an archive of mails. One way you can achieve it is you can automatically forward mails from your current mail account to another mail account. Most of all free mail services provide this facility. Then you setup offlineimap to sync this second mailbox locally. And never delete any mail from this second mailbox. Use this mailbox for only archiving.

Sachin Divekar

Posted 2011-12-04T14:17:30.180

Reputation: 776