<DKIM> Setup for syncing a gmail with lots of emails

Nicolas Sebrecht nicolas.s-dev at laposte.net
Wed Nov 16 11:04:47 GMT 2016

On Tue, Nov 15, 2016 at 10:52:41PM -0500, Rafael EspĂ­ndola wrote:
> Just wanted to share the experience I had so far tuning offline imap
> to work with my gmail account.
> I never delete emails, so by now I have a lot of them. I also love
> labels and really want to sync them.
> I started with http://www.offlineimap.org/doc/use_cases.html#sync-from-gmail-to-a-local-maildir-with-labels.
> The initial sync took a few days and created a 21 GB MailDir. That is
> fine for an initial setup.
> The issue I was then having is that each sync would take a few
> minutes, even if there was only one new email. The problem is that -q
> can only skip the sync if there is no new email and that is almost
> never the case when syncing the "All Mail" label and being subscribed
> to some open source project mailing list.
> Adding a few prints I found that almost all the time was in
>              res_type, response = imapobj.fetch("'%s'"% msgsToFetch,
>                '(FLAGS X-GM-LABELS UID)')
> And that was because it was getting information about all the
> messages. Looking around the code for where min_date and min_uid were
> coming from the solution I found was to, after the initial setup, add
> sync_deletes = no
> to both folders (I never delete email anyway) and add maxage to the
> account. Now offlineimap finds the last uid I fetched in the last few
> days and asks for just those, but doesn't delete any email.
> If I ever change labels of old messages in gmail I will have to
> remember to temporally comment maxage to sync the change but that is
> probably fine.

Be aware that changing maxage might not be as fast, currently. See


Thank you for this feedback. If you're willing to write a blog post,
the official blog is open to contributions. ,-)


Putting the emphasis to both strongness and weakness is welcome.

Nicolas Sebrecht

More information about the OfflineIMAP-project mailing list