Backing up e-mail with OfflineIMAP

By Atomstar on Saturday 11 January 2020 20:26 - Comments (12)
Category: Mac, Views: 2.442

Last week, Gandi lost quite some customer data and urged users use their own backup. Thinking about this, I realised I don't backup my (Gandi) e-mail (except for program cache), so I decided to fix using OfflineIMAP.

An alternative could be Mailstore (guide). A similar guide for Protonmail was written by peterrus.

Do you backup your e-mail? How?



I use the following config file which is a bit better than the minimal config as it will never delete, and forces TLS 1.2.

To ensure SSL works, get some CA certificate, for example from curl-ca-bundle on Mac.

# Based on https://github.com/OfflineIMAP/offlineimap/blob/master/offlineimap.conf

[general]
# List of accounts to be synced, separated by a comma.
accounts = gandi

[Account gandi]
# Identifier for the local repository; e.g. the maildir to be synced via IMAP.
localrepository = gandi-local

# Identifier for the remote repository; i.e. the actual IMAP, usually non-local.
remoterepository = gandi-remote

[Repository gandi-local]
# OfflineIMAP supports Maildir, GmailMaildir, and IMAP for local repositories.
type = Maildir

# Where should the mail be placed?
localfolders = ~/mail

# Do not propagate delete from local to remote (only add new ones)
sync_deletes = no

# Set filetime from e-mail header
utime_from_header = yes

[Repository gandi-remote]
# Remote repos can be IMAP or Gmail, the latter being a preconfigured IMAP.
type = IMAP
remotehost = mail.gandi.net
remoteuser = <username>

# Do not propagate delete from remote to local (only add new ones)
sync_deletes = no

# Force TLS/SSL
starttls = yes
ssl = yes
# Force TLS to use either tls1.2 or tls1.1
tls_level = tls_secure
# Further force client to only use tls1.2
ssl_version = tls1_2

# Use CA file to validate host. Get from port curl-ca-bundle
sslcacertfile = /opt/local/share/curl/curl-ca-bundle.crt

Volgende: Securely wiping SSDs 29-12 Securely wiping SSDs

Comments


By Tweakers user Blokker_1999, Sunday 12 January 2020 06:48

Een backup zou ik het bij mij niet noemen, maar er is natuurlijk de offline kopie in mijn mail client. En ja, die heb ik na een server verhuis al eens gebruikt om mijn mail terug te zetten. Nieuwe mailserver opgezet en in plaats van de oude mail dirs te syncen (weet al niet meer waarom dat niet mogelijk was, vermoed dat ik van mailsoftware wisselde) uiteindelijk gewoon de offline kopie uit mijn thunderbird naar de nieuwe mailbox gesleept, uurtje gewacht en alles was weer zoals het hoorde.

[Comment edited on Sunday 12 January 2020 06:49]


By Tweakers user vanaalten, Sunday 12 January 2020 11:27

Perhaps good practice to have your own backup of your data, but: if you cannot trust a professional paid service to have a decent backup (and restore procedure) in place, I would consider to move to a different party...

By Tweakers user Sterk1, Sunday 12 January 2020 11:57

Goed idee.
Ik gebruik zoiets al jaren om mijn email te archiveren.
Op een gegeven moment zit je mailbus toch echt vol.

Bovendien beschermt het tegen per ongeluk mail weggooien. Daar helpt nl geen backup van een provider tegen.

By Tweakers user fvdberg, Monday 13 January 2020 11:56

archiveren is een goede gewoonte, maar ook voor gewone gebruikers toegankelijk met software als mailstore home.

https://www.mailstore.com/en/products/mailstore-home/

En zelfs Seniorenweb heeft een handleiding:

https://www.seniorweb.nl/software/mailstore

"gebruik het zelf ook"

By Tweakers user hmmmmmmmmmpffff, Monday 13 January 2020 15:42

vanaalten wrote on Sunday 12 January 2020 @ 11:27:
Perhaps good practice to have your own backup of your data, but: if you cannot trust a professional paid service to have a decent backup (and restore procedure) in place, I would consider to move to a different party...
Microsoft doet het ook niet. Die zijn toch wel vrij groot en betrouwbaar. Backups moet je gewoon zelf regelen. Wel eens van SPOF gehoord?

By peterrus, Tuesday 14 January 2020 07:57

Nice, offlineimap rocks! I did a similar tutorial for Protonmail: https://github.com/peterrus/protonmail-export-linux

By Tweakers user Ravefiend, Tuesday 14 January 2020 12:47

This blog post caught my interest at first as to this date, I do not have a good handle on backing up my Gmail accounts so I did a bit of research into OfflineIMAP.

While I was considering this to be the perfect tool to get installed into a jail on my FreeNAS machine, the one thing that concerns me is the lack of future development of OfflineIMAP. It's main developer has pointed out that his intent is to have OfflineIMAP being replaced by IMAPfw yet both are not under active development from what I can tell.

In summary:
  • OfflineIMAP does not support Phyton 3.x, while the current Phyton 2.x is EOL in April of this year.
  • IMAPfw (based on Phyton 3.x) does not seem to have any active development going on. Latest frequent commits were done in 2016, with only one more commit in 2017.
  • The main developer at this point is primarily asking for 'money' to back him up on these tools going forward, ref. his last update in Dec 2019 - https://github.com/Offlin...72#issuecomment-562383486 and without that, I doubt any issues will be fixed / improved.
That leads me to conclude that neither OfflineIMAP nor IMAPfw will last for long which is a shame as in my view they do have potential.

[Comment edited on Tuesday 14 January 2020 12:49]


By burne, Tuesday 14 January 2020 20:38

Uhm.. Python 2.* has been EOL since like two weeks ago. https://pythonclock.org/

If OfflineIMAP works for you now, it is likely to keep working. IMAP4v1 is a spec from 2003.

By Tweakers user Atomstar, Wednesday 15 January 2020 18:30

vanaalten wrote on Sunday 12 January 2020 @ 11:27:
[...]if you cannot trust a professional paid service to have a decent backup (and restore procedure) in place, I would consider to move to a different party...
All my backups are in case something unexpectedly goes wrong, same for e-mail ;)

By Tweakers user Atomstar, Wednesday 15 January 2020 18:30

fvdberg wrote on Monday 13 January 2020 @ 11:56:
archiveren is een goede gewoonte, maar ook voor gewone gebruikers toegankelijk met software als mailstore home
Thanks, looks decent. I'll add it to a list of alternatives.

By Tweakers user Atomstar, Wednesday 15 January 2020 18:31

Ravefiend wrote on Tuesday 14 January 2020 @ 12:47:
This blog post caught my interest at first as to this date, I do not have a good handle on backing up my Gmail accounts so I did a bit of research into OfflineIMAP.[...]

That leads me to conclude that neither OfflineIMAP nor IMAPfw will last for long which is a shame as in my view they do have potential.
Thanks for your analysis, I also came across the similar situation, but my approach is that I'll use it until it breaks, similar as to what @burne is suggesting. Still better than not using it ;)

By Tweakers user Marc H, Friday 17 January 2020 09:24

Ik backup de VM van mijn mailserver met Altaro, Die backup gaat naar mijn Stack opslag.

Comment form
(required)
(required, but will not be displayed)
(optional)