A simple script using mailbox2dbmail

#!/bin/sh
#
# Dovecot IMAP folders
#
for USER in `ls /home`
do
    if [ -d /home/$USER/mail ]
    then
        for MAILBOX in `ls /home/$USER/mail`
        do
        if [ -s /home/$USER/mail/$MAILBOX ]
        then
            echo "Processing: "/home/$USER/mail/$MAILBOX
            mailbox2dbmail -u $USER -t mbox -b $MAILBOX -m /home/$USER/mail/$MAILBOX
        fi    
        done
    fi
done
#
# Sendmail mailboxes
#
for USER in `ls /var/spool/mail`
do
    echo "Processing: "/var/spool/mail/$USER
    mailbox2dbmail -u $USER -t mbox -m /var/spool/mail/$USER
done
 
migration_from_sendmail_dovecot.txt · Last modified: 2012/02/27 21:38 by bas
 
DBMail is developed by Paul J Stevens together with developers world-wide