joeyates / imap-backup

Backup and Migrate IMAP Email Accounts
MIT License
1.37k stars 75 forks source link

Error while trying to restore emails #113

Closed ojoeth closed 2 years ago

ojoeth commented 2 years ago

I am trying to use this tool to switch main providers (docker-mailserver to Hetzner.)

I backed up my mail, changed the server in the server settings and tried to restore, but I got this response:

/usr/lib/ruby/2.7.0/net/imap.rb:1221:in `get_tagged_response': Client tried to access nonexistent namespace. (Mailbox name should probably be prefixed with: INBOX.) (0.001 + 0.067 + 0.066 secs). (Net::IMAP::NoResponseError)

joeyates commented 2 years ago

Hi @ojoeth

I'll check this asap. In the meantime, please turn on debug logging (via the first menu of the imap-backup setup utility) and retry. That should give me the info I need to fix this quickly. Remember to check any log you paste for sensitive info.

ojoeth commented 2 years ago
/srv/imap-backup# imap-backup restore
D, [2022-02-03T20:08:11.362762 #446907] DEBUG -- : Creating IMAP instance: mail.your-server.de, options: {:port=>993, :ssl=>{:ssl_version=>:TLSv1_2}}
D, [2022-02-03T20:08:11.363505 #446907] DEBUG -- : Logging in: redacted-email/xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
S: * OK [CAPABILITY IMAP4 IMAP4rev1 UIDPLUS CHILDREN NAMESPACE THREAD=ORDEREDSUBJECT THREAD=REFERENCES SORT QUOTA IDLE ACL ACL2=UNION] perdition ready on ::ffff:192.168.0.11 00041769
C: RUBY0001 LOGIN redacted-email [PASSWORD REDACTED]
S: * CAPABILITY IMAP4rev1 SASL-IR LOGIN-REFERRALS ID ENABLE IDLE SORT SORT=DISPLAY THREAD=REFERENCES THREAD=REFS THREAD=ORDEREDSUBJECT MULTIAPPEND URL-PARTIAL CATENATE UNSELECT CHILDREN NAMESPACE UIDPLUS LIST-EXTENDED I18NLEVEL=1 CONDSTORE QRESYNC ESEARCH ESORT SEARCHRES WITHIN CONTEXT=SEARCH LIST-STATUS BINARY MOVE SNIPPET=FUZZY PREVIEW=FUZZY STATUS=SIZE SAVEDATE LITERAL+ NOTIFY SPECIAL-USE QUOTA
S: RUBY0001 OK You are so in
D, [2022-02-03T20:08:11.671450 #446907] DEBUG -- : Login complete
C: RUBY0002 EXAMINE Templates
S: RUBY0002 NO Client tried to access nonexistent namespace. (Mailbox name should probably be prefixed with: INBOX.) (0.001 + 0.025 + 0.024 secs).
W, [2022-02-03T20:08:11.722060 #446907]  WARN -- : Folder 'Templates' does not exist on server
C: RUBY0003 EXAMINE Templates
S: RUBY0003 NO Client tried to access nonexistent namespace. (Mailbox name should probably be prefixed with: INBOX.) (0.001 + 0.025 + 0.024 secs).
W, [2022-02-03T20:08:11.772604 #446907]  WARN -- : Folder 'Templates' does not exist on server
C: RUBY0004 CREATE Templates
S: RUBY0004 NO Client tried to access nonexistent namespace. (Mailbox name should probably be prefixed with: INBOX.) (0.001 + 0.068 + 0.067 secs).
Traceback (most recent call last):
    30: from /usr/local/bin/imap-backup:23:in `<main>'
    29: from /usr/local/bin/imap-backup:23:in `load'
    28: from /var/lib/gems/2.7.0/gems/imap-backup-4.2.2/bin/imap-backup:9:in `<top (required)>'
    27: from /var/lib/gems/2.7.0/gems/imap-backup-4.2.2/lib/imap/backup/logger.rb:29:in `sanitize_stderr'
    26: from /var/lib/gems/2.7.0/gems/imap-backup-4.2.2/bin/imap-backup:10:in `block in <top (required)>'
    25: from /var/lib/gems/2.7.0/gems/thor-1.2.1/lib/thor/base.rb:485:in `start'
    24: from /var/lib/gems/2.7.0/gems/thor-1.2.1/lib/thor.rb:392:in `dispatch'
    23: from /var/lib/gems/2.7.0/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'
    22: from /var/lib/gems/2.7.0/gems/thor-1.2.1/lib/thor/command.rb:27:in `run'
    21: from /var/lib/gems/2.7.0/gems/imap-backup-4.2.2/lib/imap/backup/cli.rb:68:in `restore'
    20: from /var/lib/gems/2.7.0/gems/imap-backup-4.2.2/lib/imap/backup/cli/restore.rb:15:in `run'
    19: from /var/lib/gems/2.7.0/gems/imap-backup-4.2.2/lib/imap/backup/cli/helpers.rb:26:in `each_connection'
    18: from /var/lib/gems/2.7.0/gems/imap-backup-4.2.2/lib/imap/backup/cli/accounts.rb:16:in `each'
    17: from /var/lib/gems/2.7.0/gems/imap-backup-4.2.2/lib/imap/backup/cli/accounts.rb:16:in `each'
    16: from /var/lib/gems/2.7.0/gems/imap-backup-4.2.2/lib/imap/backup/cli/helpers.rb:27:in `block in each_connection'
    15: from /var/lib/gems/2.7.0/gems/imap-backup-4.2.2/lib/imap/backup/cli/restore.rb:15:in `block in run'
    14: from /var/lib/gems/2.7.0/gems/imap-backup-4.2.2/lib/imap/backup/account/connection.rb:96:in `restore'
    13: from /var/lib/gems/2.7.0/gems/imap-backup-4.2.2/lib/imap/backup/account/connection.rb:87:in `local_folders'
    12: from /var/lib/gems/2.7.0/gems/imap-backup-4.2.2/lib/imap/backup/account/connection.rb:87:in `glob'
    11: from /var/lib/gems/2.7.0/gems/imap-backup-4.2.2/lib/imap/backup/account/connection.rb:87:in `glob'
    10: from /var/lib/gems/2.7.0/gems/imap-backup-4.2.2/lib/imap/backup/account/connection.rb:91:in `block in local_folders'
     9: from /var/lib/gems/2.7.0/gems/imap-backup-4.2.2/lib/imap/backup/account/connection.rb:97:in `block in restore'
     8: from /var/lib/gems/2.7.0/gems/imap-backup-4.2.2/lib/imap/backup/account/connection.rb:173:in `restore_folder'
     7: from /var/lib/gems/2.7.0/gems/imap-backup-4.2.2/lib/imap/backup/account/folder.rb:43:in `create'
     6: from /usr/lib/ruby/2.7.0/forwardable.rb:235:in `create'
     5: from /usr/lib/ruby/2.7.0/net/imap.rb:481:in `create'
     4: from /usr/lib/ruby/2.7.0/net/imap.rb:1257:in `send_command'
     3: from /usr/lib/ruby/2.7.0/monitor.rb:202:in `mon_synchronize'
     2: from /usr/lib/ruby/2.7.0/monitor.rb:202:in `synchronize'
     1: from /usr/lib/ruby/2.7.0/net/imap.rb:1275:in `block in send_command'
/usr/lib/ruby/2.7.0/net/imap.rb:1221:in `get_tagged_response': Client tried to access nonexistent namespace. (Mailbox name should probably be prefixed with: INBOX.) (0.001 + 0.068 + 0.067 secs). (Net::IMAP::NoResponseError)
joeyates commented 2 years ago

Thanks @ojoeth

Your issue was timely as I have just completed implementing the imap-backup migrate command. It's released with version '5.0.0'.

As the requirements of a restore a different from a migration, I have opted for a separate command.

In the case of Hetzner, you'll need to indicate that the '--destination-prefix' is "INBOX.", e.g.:

imap-backup migrate some@source.com other@destination.com --destination-prefix "INBOX."
ojoeth commented 2 years ago

Awesome, thanks!

salemgolemugoo commented 2 years ago

@joeyates I have the same issue with porkbun.com. I've backed up my old imap email to my local drive, now after changing dns records to pork bun I'm trying to restore this local backup to the new mail server. Migrate command is not what I want in this case

salemgolemugoo commented 2 years ago

I prefixed all .mbox and .imap folders in ~/.imap-backup/mail_box_name/ to INBOX. and it works!

joeyates commented 2 years ago

Hi @salemgolemugoo,

Could you explain why the migrate command does not do what you need? Thanks!