This, too, should probably have a wiki entry.

In dbmail, deleting a message and it being removed from the database is
a 3 step process.  1)  When you "delete" a message with your mail
client, it simply updates the message status in the database.  2)  At
some later time dbmail-util is run to change from a "deleted" status to
a "go ahead and remove from the database" status.  3)  At a subsequent
run of dbmail-util, those last messages are actually removed from the
database.

So, how to recover an accidentally deleted message depends on where
you're at in that process.  In either setup 1 or 2, you can simply
update the dbmail_messages entry to set the status back to 0 or 1.  Yes,
it's normally that simple.

  After step 3 has taken place, the message is gone from the database
and you'd have to restore it from an external source.  You can backup an
entire database using something like mysqldump, but that's not as well
suited for restoring individual mailboxes.  For that purpose, you can
periodically export mailboxes in mbox format (there's a tool for that,
maybe dbmail-export? or maybe dbmail-util again?).  Restoring a message
from an mbox file would be fairly similar to restoring a Maildir, it's
just all mail in one file vs. one message per file .. there are tools to
make it simple to process mbox files, or you can probably manage pretty
easily with just a plain text editor, too (unless the mbox is really
large or something).  Get your message(s) you want to restore, then feed
then into dbmail-smtp to re-inject them back into the database.  You can
specify the user and mailbox to put it in.


> We use for now Courier-IMAP because for us it's easy to restore deleted
> mail from our backups into the home Maildir. How can we do that with
> DBmail ?

-- 
Jesse Norell - [EMAIL PROTECTED]
Kentec Communications, Inc.

Reply via email to