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?