The Lotus Domino server provides an IMAP task which does more or less what it is supposed to do: serve incoming messages to IMAP clients via the IMAP protocol. IMAP is enabled on the Domino user’s mail file with a load convert -m mail/username.nsf performed from the administration console.

We have started migrating a small number of users from Lotus Domino to a new open source based mail server and I wanted them to at least be able to take some of their mail along. This is easily done with fetchmail, a mail retrieval and forwarding utility which can read just about anything from anywhere and dump it wherever ;-)

Since we are using a Maildir-based Dovecot, I simply create a new directory under the user’s Maildir (e.g. ~/Maildir/Lotus), populate that with a correct maildir format (three directories new, cur and tmp need to be created), change to ~/Maildir/Lotus/cur and get fetchmail to retrieve mail from the user’s Inbox:

    fetchmail --keep \
        --all  \
        --ssl \
        -P 993 \
        --mda /bin/migrate-mda \
       -u username \
       --protocol imap \

Here I’m telling fetchmail to use the given script as a Mail Delivery Agent. The script simply creates a unique name in that directory and reads whatever fetchmail gave it to stdin, copying that into the file:

    cat > "lotus.`date +%N`.$$"

The filenames generated look like lotus.671129000.740, the second part been the nano second and the last part the process-id of the mda script.

This will grab all messages (--all) from the user’s Inbox, leaving it on the Domino server (--keep). If you want to get messages from one or more real folders (not views!) in your Notes mail file, add the --folder=Name to the fetchmail invocation (RTFM).

Do ensure that all files and directories in the newly created subfolder of the user’s maildir have the correct permissions and ownership.

Mail and DomiNotes :: 14 Jan 2006 :: e-mail