undelete a single message, delete_mode + expunge_mode activated
Simon Amor
simon at leaky.org
Mon Mar 10 17:04:29 EDT 2014
On 10 Mar 2014, at 20:31, Marcus Schopen <lists at localguru.de> wrote:
>
> When deleting a single message from Inbox or a subfolder these message
> are not moved into a DELETED structure and keep staying at their
> originally place on filesystem. Those messages are definitely delete. I
> can't see them in my imap client anymore (tested with evolution and
> Thunderbird). How do I undelete these single messages?
Undeleting messages in a mailbox
The following examples assume you have an installation of cyrus where there are binaries in /usr/lib/cyrus-imapd/ - if not, adjust path to suit.
List messages available to unexpunge:
# su cyrus -c "/usr/lib/cyrus-imapd/unexpunge -l user/simon at leaky.org"
Each message will give you something like the following:
UID: 11422
Size: 7786
Sent: Mon Mar 10 12:00:00 2014
Recv: Mon Mar 10 16:06:32 2014
Expg: Mon Mar 10 16:53:55 2014
From: john wade <jwade at oakton.edu>
To : <info-cyrus at lists.andrew.cmu.edu>
Cc :
Bcc :
Subj: {44}
re: sieveshell aborts with "expected rparen"
To unexpunge a single message:
# su cyrus -c "/usr/lib/cyrus-imapd/unexpunge -udv user/simon at leaky.org 11422"
restoring expunged messages in mailbox 'user/simon at leaky.org'
Unexpunged user/simon at leaky.org: 11422 => 11438
restored 1 expunged messages
To unexpunge all the messages and mark them as undeleted as well:
# su cyrus -c "/usr/lib/cyrus-imapd/unexpunge -adv user/simon at leaky.org"
NOTE: This isn't recursive
It will only restore the inbox. To find other folders run
# su cyrus -c "/usr/lib/cyrus-imapd/ctl_mboxlist -d" | grep leaky.org
leaky.org!user.simon 0 default simon at leaky.org lrswipkxtecda
leaky.org!user.simon.Lists 0 default simon at leaky.org lrswipkxtecda
leaky.org!user.simon.Lists.cyrus 0 default simon at leaky.org lrswipkxtecda
leaky.org!user.simon.Deleted Messages 0 default simon at leaky.org lrswipkxtecda
Run the unexpunge command for every folder that needs to have mail undeleted.
For folder names that have spaces ' ', the spaces need to be escaped with a backslash
su cyrus -c "/usr/lib/cyrus-imapd/unexpunge -adv user/simon/Deleted\ Messages at leaky.org"
More information about the Info-cyrus
mailing list