Emails not visible on freshly installed CentOS 6 with Virtualmin

Emails not visible on freshly installed CentOS 6 with Virtualmin

Main symptom of a problem is that emails are visible in the Read User Mail utility in Webmin but they do not show up in either webmail (Roundcube/Squirrelmail), Usermin or any email client configured to connect to the server.

After further inspection, it appears the emails get delivered to /var/mail/usermailbox@domain.tld instead of /home/username/homes/usermailbox/Maildir. Dovecot (the POP/IMAP server) uses the Maildir format, while Postfix (the SMTP server) is by default set to use mbox.

 

To correct this, check and make sure Postfix is configured to use the Maildir format and whether it uses procmail for delivery:

# cat /etc/postfix/main.cf | grep home_mailbox
home_mailbox = Maildir/
# cat /etc/postfix/main.cf | grep mailbox_command
mailbox_command = /usr/bin/procmail-wrapper -o -a $DOMAIN -d $LOGNAME

 

Also check that the procmail config is correctly set to use Maildir boxes instead of the default mbox. The working config should be similar to (note the DEFAULT and ORGMAIL lines containing Maildir/):

LOGFILE=/var/log/procmail.log
TRAP=/etc/webmin/virtual-server/procmail-logger.pl
:0wi
VIRTUALMIN=|/etc/webmin/virtual-server/lookup-domain.pl --exitcode 73 $LOGNAME
EXITCODE=$?
:0
* ?/usr/bin/test "$EXITCODE" = "73"
/dev/null
EXITCODE=0
:0
* ?/usr/bin/test "$VIRTUALMIN" != ""
{
INCLUDERC=/etc/webmin/virtual-server/procmail/$VIRTUALMIN
}
DEFAULT=$HOME/Maildir/
ORGMAIL=$HOME/Maildir/
DROPPRIVS=yes
:0
$DEFAULT

 

After adjusting both the configuration and the procmail config, send yourself a test email and check if it gets delivered and is readable in your email clients or not.

If this test is successful and you are sure you have some useful emails that were already delivered while the server was misconfigured and you want to recover them, download mb2md (local copy in case original site becomes unavailable) and use it to convert your mailboxes from mbox to Maildir:

perl mb2md.pl -s /var/mail/[account-domain.tld] -d /home/[username]/homes/[account]/Maildir/

Leave a Reply