QQ登录

只需一步,快速开始

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 2124|回复: 1

Cyrus IMAP Mailbox Recovery

[复制链接]
发表于 2009-6-9 16:39:26 | 显示全部楼层 |阅读模式
Step 1: Backup the locally-cached mail
The file will be inside ~/Library/Mail/IMAP-email-address, with an extension ".imapmbox". Copy this file to your Desktop.
Step 2: Repairing the Cyrus folder
  • Use Server Admin to stop the mail server
  • Change to root, and enter the directory /var/imap:
    # sudo -s
    # cd /var/imap
  • backup mailboxes.db:
    # cp mailboxes.db mailboxes.db-backup
  • Using Workgroup Manager, set user cyrus's shell to bash
    (Ed. note: Rather than give cyrus a shell you could just use sudo -u cyrus to do the following steps.)
  • su to cyrus, and dump the database to a text file:
    # su cyrus
    # /usr/bin/cyrus/bin/ctl_mboxlist -d > /tmp/mboxlist.txt
  • Edit the text file and remove the lines that contain the problem folders:
    # pico /tmp/mboxlist.txt
  • remove mailboxes.db:
    # rm mailboxes.db
  • rebuild mailboxes.db from the new text file:
    # cat /tmp/mboxlist.txt | /usr/bin/cyrus/bin/ctl_mboxlist -u
  • Reconstruct all mailboxes
    # /usr/bin/cyrus/bin/reconstruct -r -f userIf there are any remaining folders that print an error, they'llbe listed when performing cyrus reconstruct: (ie.. user.someuser:Mailbox does not exist).
  • Exit back from cyrus and root
    # exit
    # exit
  • Using Workgroup Manager, set user cyrus's shell back to /usr/bin/false.
  • Restart Mail using Server Admin
Step Three: Recovering a locally-cached imapmbox
  • Create a fake imap email account. Don't use a real name or password. We want the account to remain offline.
  • Quit Mail
  • In the Finder, open the directory holding the newly-created INBOX.imapmbox file (It's in ~/Library/Mail/IMAP-something/").
  • Move this (empty) INBOX.imapmbox to the trash.
  • Move the cached mail file you had copied to the Desktop to this folder. Rename the file to "INBOX.imapmbox".
  • Start Mail again, and click on the new account name. Your messages should reappear.
  • Copy the messages from this folder to another one, either IMAP or locally.
  • In Mail's preferences, delete the account you had created.
Make sure you keep this fake account offline, or else Mail will overwrite your cached mailbox with an empty one!
发表于 2009-6-9 18:08:59 | 显示全部楼层
继续 BS
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

GMT+8, 2024-12-1 18:54 , Processed in 0.063828 second(s), 16 queries .

© 2021 Powered by Discuz! X3.5.

快速回复 返回顶部 返回列表