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:

  1. 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)

  2. 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.


You can set up a rule to forward all sent mail to another popbox if you want to keep it separated. Otherwise I don't see how you can do this, unless you download all mail.

Why don't you combine the two, just download all mail into Thunderbird, and stop the forwarding?

  • 1
    Thank you for the answer. I was not aware that I can use rules in Gmail for sending mails as well; but I assume that this will not forward the BCC headers. – Jakob Dec 10 '13 at 13:48
  • To be honest - I'm not so sure now that you can use rules for sent mails now I think of it. You have to try, and hopefully it works out for you! – SPRBRN Dec 11 '13 at 13:37
  • In any case, I would like to automatically download mails (as described above), i.e., using some script in cron.daily or similar; not using Thunderbird. What would be the canonical tool for that (simple) task? – Jakob Dec 12 '13 at 11:51
  • You can use a python script to do this. I haven't tested this myself, just googled it... See stackoverflow.com/questions/8669202/… – SPRBRN Dec 16 '13 at 13:05

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.