Biggest headache!

I’ve spent hours trying to get the Maildir storage of a Postfix install working on a Virtualmin box that had been migrated from Plesk.

There a few critical steps to get everything working. There are lots of references out there, but none covered all my issues at once. All these bits might need setting or just verifying to make it all happy, and this is done on a CentOS 5 box.
Ultra critical points for me were step 1 (6th line), step 6, step 7, step 9 and the last few command line instructions (especially the 1st line).

  1. Webmin -> Webmin -> Usermin Configuration -> Usermin Module Configuration -> Read mail
    Mail storage format for Inbox = Remote IMAP server
    Sendmail mail file location = /var/spool/mail
    Qmail or MH directory location = Subdirectory under home directory
    Qmail or MH directory in home directory = Maildir
    POP3 or IMAP server name = localhost (this might need to be typed explicitly)
    Sendmail command = /usr/lib/sendmail
    Default hostname for From: address = From real hostname
    Allow editing of From: address = yes
    From: address mapping file = /etc/postfix/virtual
    Address mapping file format = Address to username(virtusertable)
  2. Webmin -> Webmin Configuration -> Webmin Modules
    Install Postfix
    Remove Sendmail
  3. Webmin -> Servers -> Postix Mail Server -> General Options
    What domain to use in outbound mail = Use hostname
    What domains to receive mail for = $myhostname, localhost.$mydomain, localhost, localhost.localdomain
    Send outgoing mail via host = Deliver directly
    Default database type = hash
    Internet hostname of this mail system = Default (provided by system)
    Local internet domain name = Default (provided by system)
    Local networks = Default (all attached networks)
  4. Webmin -> Servers -> Postix Mail Server -> Mail Aliases
    Alias databases used by the local delivery agent = hash:/etc/aliases
    Alias databases built by “newaliases” command = hash:/etc/aliases
  5. Webmin -> Servers -> Postfix Mail Server -> Virtual Domains
    Domain mapping lookup tables = hash:/etc/postfix/virtual
    Domains to perform virtual mapping for = From domain mapping tables
  6. Webmin -> Servers -> Postfix Mail Server -> Local Delivery
    Home-relative pathname of user mailbox file = Maildir/
  7. Webmin -> Servers -> Procmail Mail Filter
    Set variable DEFAULT to $HOME/Maildir/
    Set variable ORGMAIL to $HOME/Maildir/
  8. Webmin -> Networking -> Networking Configuration -> Hostname and DNS Client
    Hostname = localhost.localdomain
  9. Webmin -> Networking -> Networking Configuration -> Host Addresses = localhost, localhost.localdomain
    <your external IP address> = <FQDN> (eg. =
    Then click ‘Apply Configuration’

The last few steps are best done from the root command line…

hostname  (eg. hostname
mkdir -p /etc/skel/Maildir/new mkdir -p /etc/skel/Maildir/cur mkdir -p /etc/skel/Maildir/tmp
wget -c
chmod +x convert-and-create
postmap /etc/postfix/virtual
service postfix restart

Few extra pointers ..
you need

host `hostname`

to give you the <hostname.FQDN> and external IP address (take note of the backticks, not apostrophes)… has address

and looking inside /etc/hosts, you should see the 2nd line as your external IP address and just the <FQDN>…   localhost   localhost.localdomain

You’re looking for the results of

postconf -n

to look something like this

alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
broken_sasl_auth_clients = yes
command_directory = /usr/sbin
config_directory = /etc/postfix
daemon_directory = /usr/libexec/postfix
debug_peer_level = 2
home_mailbox = Maildir/
html_directory = no
inet_interfaces = all
mail_owner = postfix
mailbox_command = /usr/bin/procmail-wrapper -o -a $DOMAIN -d $LOGNAME
mailq_path = /usr/bin/mailq.postfix
manpage_directory = /usr/share/man
mydestination = $myhostname, localhost.$mydomain, localhost, localhost.localdomain
newaliases_path = /usr/bin/newaliases.postfix
queue_directory = /var/spool/postfix
readme_directory = /usr/share/doc/postfix-2.3.3/README_FILES
sample_directory = /usr/share/doc/postfix-2.3.3/samples
sender_bcc_maps = hash:/etc/postfix/bcc
sendmail_path = /usr/sbin/sendmail.postfix
setgid_group = postdrop
smtpd_recipient_restrictions = permit_mynetworks permit_sasl_authenticated reject_unauth_destination
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
unknown_local_recipient_reject_code = 550
virtual_alias_maps = hash:/etc/postfix/virtual

Anyway, hope that helps .. you can wake up and leave now if you like.


Jonathan Adjei

Jon's expertise in web development is legendary and he oversees all technical aspects of our projects from development to hosting (all through the command line!)Jon is excited by the latest techniques and keeps the company on track by finding ways to adopt new practices into our workflow.