I use gmail, but would like to have a local backup (on a ubuntu machine) of the emails as well. (I do not need two way synchronisation or anything like that, just backup)
I already back up all incoming emails (by simply forwarding everything to another account and then using fetchmail with no rewrite fetchall nokeep).
In addition, I would like to backup the sent mails. (I do not want to just bcc them to my backup address: On the one hand I would have to add this bcc manually for every email, and will most likely forget that regularly; also I would like to back up the email including BCC headers etc)
This seems to consist of two tasks:
Firstly I would like to backup the "backlog": I currently have about 18K messages in gmail sent-mail; about 1K of them from the time after I migrated to gmail (only these have to be backuped). So I need a tool (as simple as possible to use) which I can tell: get all mails from IMAP folder "SENT-MAIL" with date after .... (and do not change anything on the remote site)
then I would like to download the new sent-items regularly (once a day maybe). It should be robust, fast and simple. It is no problem if I miss a mail because I, e.g., deleted it on gmail before the backup etc. There is no need to "re-scan" old mails for changes (e.g., the backup script would only have to look at the mails that are newer than the last backup run). I do not care if there is the danger to miss a mail every few months because of some weird race conditions or whatever I might not be aware of (mails is sent in exactly the same moment that the script runs or whatever) So I need a tool (as simple as possible to use) which I can tell: get all mails from IMAP folder "SENT-MAIL" that are new since the last time you ran (and do not change anything on the remote site)
The problem seems to be that there are several options and issues involved that I do not understand (and do not want to understand); obviously for performance issues I do not want a script that each time creates a list of all available mails at the remote and the local site and then makes diffs; as I said the script doesn't even have to check that the previously backed up emails are still on the local machine.
I do not know how a simple fetchmail (IMAP) would perform/behave (for the incoming mail I use an intermediate account and fetchmail with fetchall nokeep; which seems simple and robust; I do not know how well fetchmail performs with thousands of mails that should be unchanged and only the "new" ones fetched)
I have seen several sync tools (such as OfflineIMAP or mbsync) which all seem to be an overkill for my need (and there might be a danger that they sync, i.e., change the remote site, in case I do something stupid in the config files.)
I would be grateful for any help.