Feb
26
2014
Restoring deleted mail on the server from mail-client copy
Posted by Vitalie CiubotaruAlthough I consider myself a seasoned Seamonkey user, I regularly bump into the same problem: after I set up a new mail account, it fetches all mail from the server and happily deletes the originals. It is not much of a problem, because I delete them from time to time, but I still felt somewhat uneasy to see them deleted. Same thing happened yesterday. Recently I switched to my own mail server and, as have full control over it, I figured that this time I should be able to put my mail back. Here’s how I managed to restore all deleted mail.
Step 1. Find your local mailbox
Seamonkey stores its local mailbox somewhere like ~/.mozilla/seamonkey/8fde346h.default/Mail
. In case you fetch mail from several addresses, there will be several sub-directories here (one for each source of mail). Locate the directory that corresponds to the mailserver you need, cd
to it, and find the file called Inbox
.
Step 2. Upload your mailbox file to your mailserver
scp Inbox username@mailserver.name:/path/to/user/home
Step 3. Transfer the messages into your mail account
This is the most important part. Once your mbox file is on the server, you need to parse it and move every message into your mail account. I did it with
formail -s /usr/lib/dovecot/dovecot-lda -d username < Inbox
Wait for the transfer to end (it may take quite some time, depending on the mailbox size), clean up (delete the Inbox
file).
Downsides:
- The dates will be broken (the date of transfer instead of the date when the original mail arrived).
- Because of the issue above, your mail client will download all messages again.