joeyates / imap-backup

Backup and Migrate IMAP Email Accounts
MIT License
1.33k stars 74 forks source link

Error Restoring #129

Closed metanodotto closed 1 year ago

metanodotto commented 1 year ago

I've backed up my email address "my@email.com" on the old imap server and I'd like to restore it to the new server.

As you wrote in readme I did this:

  1. did a new setup and created new email with the new server connection
  2. created the folder to match the new email but without run the backup
  3. copied the inbox.mbox and inbox.imap to the folder of the new mail
  4. run the restore with this command: imap-backup restore my@email.com

It fails with this error:

/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/net/imap.rb:1221:inget_tagged_response': Client tried to access nonexistent namespace. (Mailbox name should probably be prefixed with: INBOX.) (0.001 + 0.038 + 0.037 secs). (Net::IMAP::NoResponseError) from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/net/imap.rb:1275:in block in send_command' from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/monitor.rb:235:inmon_synchronize' from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/net/imap.rb:1257:in send_command' from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/net/imap.rb:481:increate' from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/forwardable.rb:230:in create' from /opt/homebrew/Cellar/imap-backup/6.3.0/libexec/gems/imap-backup-6.3.0/lib/imap/backup/account/folder.rb:44:increate' from /opt/homebrew/Cellar/imap-backup/6.3.0/libexec/gems/imap-backup-6.3.0/lib/imap/backup/uploader.rb:68:in rename_serialized_folder' from /opt/homebrew/Cellar/imap-backup/6.3.0/libexec/gems/imap-backup-6.3.0/lib/imap/backup/uploader.rb:13:inrun' from /opt/homebrew/Cellar/imap-backup/6.3.0/libexec/gems/imap-backup-6.3.0/lib/imap/backup/account/connection.rb:83:in block in restore' from /opt/homebrew/Cellar/imap-backup/6.3.0/libexec/gems/imap-backup-6.3.0/lib/imap/backup/account/connection.rb:77:inblock in local_folders' from /opt/homebrew/Cellar/imap-backup/6.3.0/libexec/gems/imap-backup-6.3.0/lib/imap/backup/account/connection.rb:73:in glob' from /opt/homebrew/Cellar/imap-backup/6.3.0/libexec/gems/imap-backup-6.3.0/lib/imap/backup/account/connection.rb:73:inglob' from /opt/homebrew/Cellar/imap-backup/6.3.0/libexec/gems/imap-backup-6.3.0/lib/imap/backup/account/connection.rb:73:in local_folders' from /opt/homebrew/Cellar/imap-backup/6.3.0/libexec/gems/imap-backup-6.3.0/lib/imap/backup/account/connection.rb:82:inrestore' from /opt/homebrew/Cellar/imap-backup/6.3.0/libexec/gems/imap-backup-6.3.0/lib/imap/backup/cli/restore.rb:20:in run' from /opt/homebrew/Cellar/imap-backup/6.3.0/libexec/gems/imap-backup-6.3.0/lib/imap/backup/cli.rb:120:inrestore' from /opt/homebrew/Cellar/imap-backup/6.3.0/libexec/gems/thor-1.2.1/lib/thor/command.rb:27:in run' from /opt/homebrew/Cellar/imap-backup/6.3.0/libexec/gems/thor-1.2.1/lib/thor/invocation.rb:127:ininvoke_command' from /opt/homebrew/Cellar/imap-backup/6.3.0/libexec/gems/thor-1.2.1/lib/thor.rb:392:in dispatch' from /opt/homebrew/Cellar/imap-backup/6.3.0/libexec/gems/thor-1.2.1/lib/thor/base.rb:485:instart' from /opt/homebrew/Cellar/imap-backup/6.3.0/libexec/gems/imap-backup-6.3.0/bin/imap-backup:14:in block in <top (required)>' from /opt/homebrew/Cellar/imap-backup/6.3.0/libexec/gems/imap-backup-6.3.0/lib/imap/backup/logger.rb:29:insanitize_stderr' from /opt/homebrew/Cellar/imap-backup/6.3.0/libexec/gems/imap-backup-6.3.0/bin/imap-backup:13:in <top (required)>' from /opt/homebrew/Cellar/imap-backup/6.3.0/libexec/bin/imap-backup:23:inload' from /opt/homebrew/Cellar/imap-backup/6.3.0/libexec/bin/imap-backup:23:in <main>'

any help would be apreciated

joeyates commented 1 year ago

Hi @metanodotto

Please try the migrate command, which allows you to specify IMAP namespaces ('prefixes') when moving from one service to another.

metanodotto commented 1 year ago

hi @joeyates

The old imap is closed. All I have is a local backup done with your imap-backup.

the new one is not empty anymore because it has received mail in the past 4 days.

So I read in the help that migrate command (if I correctly understood) works with 2 active accounts (that I don't have) and that it stops with error if destination is not empty (my destination is not empty and I have to keep new mails).

could you help me?

joeyates commented 1 year ago

Hi @metanodotto

First of all, both accounts don't need to be active - you only need the local backup (of the old account) plus an active destination account.

It is true that the migrate command requires that destination folders be empty.

As a workaround, you can change the names of your backups from the old server:

This way you should end up with all your old emails in folders which don't otherwise exist on the new server, so you can manually move them wherever you like.

Let me know if that works!

joeyates commented 1 year ago

@metanodotto Any progress on this?