Out of the box, CentOS5 installs Sendmail using Procmail as local delivery agent, and Dovecot. The inbox is in /var/spool/mail/~ and any user folders are stored in mbox format in ~/mail/
If we access an email account with IMAP, there are some issues with folders and sub-folders. The solution to these problems, is to swap over to Maildir.
To do so, we need to make some changes to Dovecot & Procmail
Edit “/etc/procmailrc” and change:
ORGMAIL=$HOME/Maildir/
DEFAULT=$HOME/Maildir/
Edit “/etc/dovecot” and change:
mail_location = maildir:~/Maildir
pop3_uidl_format = %08Xu%08Xv
If you prefer to use Webmin:
Servers -> Procmail Mail Filter -> Manually Edit Configuration.
Servers -> Dovecot IMAP/POP3 Server -> Mail Files
and set
Mail file location = "Inbox and folders in ~/Maildir"
UIDL format = "Other.. %08Xu%08Xv"
Transferring old Emails
The dovecot instructions are here.
I just downloaded the mb2md.pl script and did the rest by hand.
I logged in as root and ran the following commands for each user
First let’s import the old inbox into the Maildir format. This will also create the ~username/Maildir folder if it does not exist.
./mb2md.pl -s /var/spool/mail/linuxusername -d ~linuxusername/Maildir
Second lets import any existing other folders
./mb2md.pl -s ~linuxusername/mail -R -d ~linuxusername/Maildir
Finally we fix the file ownerships:
chown -R linuxusername:groupname /home/season/homes/linuxusername/Maildir/.*
chown -R linuxusername:groupname /home/season/homes/linuxusername/Maildir/*