6

Which Linux tools help to backup and restore a IMAP mail account including all mail and subfolders?

I expect disconnects for large IMAP accounts because of

  1. ressource limitiations on the server
  2. risk of an interruption increases with the duration.

The software should be able to reconnect and continue the job after any interruption. For repeating backups it might be very handy to use incremental backups and to run the backup script in a cron job.

2

Try to use open source project imap-backup: https://github.com/joeyates/imap-backup

$ imap-backup setup

The setup system is a menu-driven command line application.

It creates ~/.imap-backup directory and configuration file. E.g.:

{
  "accounts":
  [
    {
      "username": "my.user@gmail.com",
      "password": "secret",
      "local_path": "/path/to/backup/root",
      "folders":
        [
          {"name": "[Gmail]/All Mail"},
          {"name": "my_folder"}
        ]
    }
  ]
}

It connects to GMail by default, but you can also specify a server:

{
  "accounts":
  [
    {
      "username": "my.user@gmail.com",
      "password": "secret",
      "server": "my.imap.example.com",
      "local_path": "/path/to/backup/root",
      "folders":
        [
          {"name": "[Gmail]/All Mail"},
          {"name": "my_folder"}
        ]
    }
  ]
}
  • At least describe how how to use to tool and describe whether it accomodates the OP's expected hardships. – Jeff Schaller Aug 17 '17 at 22:35
  • I edited my post. – Quarind Aug 18 '17 at 9:05
1

You can use imapsync for this. You can get the source from fedorahosted.org imapsync page. Zimbra Guide to imapsync has good documentation about this subject.

-1

More to do with backing up than your questions but I've just found and started testing mailpiler. Not sure I like the fact of giving access to "all" email so working out how to send "older" email on regular basis to file there.

At the moment we use Awesome Auto Archive thunderbird extensions to "move" emails to another filing account.

  • mailpiler seems to be a commercial web service where you can send all your mails to. Besides obvious security concerns this is not what was asked for in this question. – Jonas Stein Dec 27 '18 at 21:58
-4

"cp -pr" should do the job. The "r" option in "pr" should take care of both subfolders and any hidden files/directories.

  • 3
    I guess this answer assumes the mails are in a Maildir type format in which case any tool to copy the files should work, and rsync might be a good option. But I think OP is interested in a solution that connects remotely through IMAP. – Mehmet Dec 14 '14 at 21:45

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.