4

I have headless debian/raspbian linux machine and I would like to backup all my emails via IMAP including all mail and subfolders once daily (connection is secured with SSL/TLS. it should run automatically from cronjob every day).

This backup should store the same emails as I have on my default mailserver - so it means when I am working from another computer whole day, it should be able to sync my work (that's why I want to use IMAP).

Ideally I would like to have all my emails in readable format on backup machine, if main mailserver fails.

Any idea how this can be done?

  • 1
    The question is unclear. Does the 2nd paragraph mean you also want to use the IMAP backup as an IMAP server to sync against, and then somehow merge it with the primary IMAP server? – András Korn Sep 16 '16 at 7:52
5

Use getmail. It's a nice python program which can be used to download mails from servers. The website is a bit dated, but the software is recent and well maintained. Here is an example config file:

[options]
delete = False

[retriever]
type = SimpleIMAPSSLRetriever
server = my-servername
username = my-username
password = my-password

[destination]
type = Maildir
path = ~/Maildir/

As you can see, one can define where the mail is to be safed. Multiple mailbox formats are supported. You could also hand mail over to a local IMAP server, e.g. dovecot. If you don't want to use SSL, use SimpleIMAPRetriever instead of SimpleIMAPSSLRetriever.

2

OfflineIMAP may be the tool you’re looking for. It pulls mail into a local tree of maildirs which I consider satisfies your “readable” requirement since you can navigate those directly in your MUA.

0

There is a tool called imapsync that used to be free and open source, but no longer is; still, the last free/open version is widely available and it can copy mail from one imapserver to another, including folders and subfolders.

So on your backup server you'd set up an arbitrary IMAP server and use imapsync to periodically copy the mail from the live server to the backup server.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.