There is a new version of this tutorial available for Ubuntu 18.04 (Bionic Beaver).

Postfix Virtual Hosting With LDAP Backend And With Dovecot As IMAP/POP3 Server On Ubuntu Trusty Tahr 14.04

Note this it the updated version of the old guide which doesn't work anymore with the new versions of Ubuntu, Postfix and Dovecot.

Here we we use an LDAP backend for both the MTA (Postfix) and POP3/IMAP server (Dovecot), and a web based management interface.

Optional in this how to is the use of Roundcube webmail and proftpd.

Software to be used in this how to: <pPostfix MTA, Dovecot IMAP / POP3, OpenLDAP, Gnarwl as autoresponder (vacation), Proftpd as ftp server, Phamm as management interface, MySQL as database backend for the webmail and Roundcube as webmail.

This worked for me, but I cannot guarantee that this set up will work for you so this how to comes without any guarantee.


This how to assumes the following configurations, if your installation differs from this, then replace the entries below with your actual configuration.

Mail delivery (mailboxes) path:


User vmail:

UID:1000, GID:1000

User postfix:

UID: 108, GID:108

OpenLDAP base dn:


OpenLDAP admin account:


Phamm search dn:


A read only account for the o=hosting,dc=example,dc=tld tree:


You're using root as the user during this guide. 

If you want for example o=maildomains or ou=domains, please make sure to replace o=hosting with what you  want, especially in the acl.ldif. This acl file is strict, phamm will not work correctly if it is not exactly as it should be. If you want a different read only user than phamm than replace cn=phamm with cn=wat-you everywhere in this how to.

This guide also assumes that you have installed and configured your Ubuntu server to your needs, there are plenty of good guides on Howtoforge for example:

The Perfect Server - Ubuntu 14.04 (Apache2, PHP, MySQL, PureFTPD, BIND, Dovecot, ISPConfig 3

Do not install and configure Postfix and Dovecot since we are going to do that in this guide.

I know there are Phamm packages in the Ubuntu repository but they do not configure anything for one and on the other hand the new configurations required for both Postfix and Dovecot are not taken in to account.


Download the Phamm package since it contains Openldap schema's we will need:

cd /usr/src

Get the latest version of phamm:


Unpack the archive:

tar xvzf phamm-0.6.2.tar.gz

Change back to the root directory

cd ~


So now let's get started

Share this page:

8 Comment(s)