Archive for February, 2014

Although 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.

Let’s assume we have three sibling elements (list items in this example, but it can be anything), like this:

<ul>
<li id="1">One</li>
<li id="2">Two</li>
<li id="3">Three</li>
</ul>

We want to cycle through them by pressing up/down keys. We want the “active” item to be highlighted somehow (say red text instead of black. All we need is some JavaScript:
var active_id = '1';
Element = document.getElementById(active_id);
Element.style.color = 'red';

document.onkeyup = KeyCheck;

function KeyCheck(e) {
var old_id = active_id;
var Key = (window.event) ? event.keyCode : e.keyCode;
switch (Key) {
case 40:
active_id++;
break;
case 38:
active_id--;
break;
}
if (active_id < 1) active_id += 3; if (active_id > 3) active_id -= 3;
Old = document.getElementById(old_id);
Old.style.color = 'black';
New = document.getElementById(active_id);
New.style.color = 'red';
};

Done. This code listens to keypress events, “filters” the Up/Down arrow presses and reacts to them by coloring our list items.

Demo on jsfiddle.