Recovering deleted mail

The aox undelete message searches for deleted messages and recovers those that match the search expression. It prints one line for each message it undeletes.

This command recovers any deleted messages in Nirmala's inbox that are from/to any address:

aox undelete /users/nirmala/inbox address

This command recovers any deleted messages that were deleted at most two days ago:

aox undelete /users/nirmala/inbox younger 2

The search syntax is documented in the aox show search command. That command is a good way to experiment with the search syntax.

Starting in 3.1.4, It is also possible to mock-undelete using -n:

aox undelete -n /users/nirmala/inbox younger 2
aox: Undeleting 3 messages into /users/nirmala/inbox
 - Message 98922 was deleted by "nirmala" at 2010-06-04 12:24:18
   Reason: IMAP expunge 37216/2/2/17
 - Message 98927 was deleted by "nirmala" at 2010-06-04 12:24:18
   Reason: IMAP expunge 37216/2/2/17
 - Message 98928 was deleted by "nirmala" at 2010-06-04 12:24:18
   Reason: IMAP expunge 37216/2/2/17
aox: Cancelling undeleting due to -n. Rerun without -n to actually undelete.

You can recover messages for for at least undelete-time days, starting when a message is deleted, and ending when aox vacuum deletes the message for good.

In some cases, the mailbox that contained the mail may itself be deleted. In that case, aox undelete creates it again, with default permissions. In particular, if the owner of the mailbox is no longer a valid user, then the mailbox will be a system mailbox, and you must grant read permision using aox setacl before any IMAP users can access it.

In case of questions, please write to

Relevant links

About this page

Last modified: 2010-11-19