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 - Page 5

This tutorial exists for these OS versions

On this page

  1. Step 6: Install And Configure phamm

Step 6: Install And Configure phamm

Since we downloaded and extracted the phamm archive before, we can directly begin with the installation and configuration of the phamm interface.

Note: I hacked into the phamm configuration and .php script files to accomplish the following:

The other hacks are just to define other defaults:

  • Setting the right mailbox location
  • Setting the quota number for mail
  • Setting the default home directory for ftp
  • Setting the default quota for ftp

In any case I believe that these changes are an improvement rather than customization so I will list them here before we go into the actual installation and configuration of phamm. Those who do not care about these features can skip the following section until the actual phamm configuration and installation.

Note: if you apply the hacks I did please remember to repeat them when you upgrade to a newer version of Phamm.

But first we need to get the phamm scripts to their proper location:

cd /usr/src/
mv phamm-0.6.2 /var/www/html
cd /var/www/html/phamm

My hacks:

The hacks are done on the source, not the actual (see later installation).

Set the defaults for email and domain creation:

vi www-data/main.php


$entry["maildrop"] = "postmaster";


$entry["mail"] = "[email protected]".$domain_new;

And also from:

$entry_abuse["maildrop"] = "postmaster";


$entry_abuse["maildrop"] = "[email protected]".$domain_new;

Change the quota in mail.xml plugin to support Dovecot quota format:

vi plugins/mail.xml 





Now we set the permissions on the directory:

chown -R www-data:www-data /var/www/phamm
cd /var/www/phamm
rm -R examples
rm -R doc
rm -R DTD
rm -R schema

This in order to remove files that are not needed and for security reasons.

Now we will configure phamm for actual use.


Change the ldap connection parameters to fit your actual configuration.

// *============================*
// *=== LDAP Server Settings ===*
// *============================*

// The server address (IP or FQDN)
define ('LDAP_HOST_NAME','');

// The protocol version [2,3]

// The server port
define ('LDAP_PORT','389');

// The container
define ('SUFFIX','dc=example,dc=tld');

// The admin bind dn (could be rootdn)
define ('BINDDN','cn=admin,dc=example,dc=tld');

// The Phamm container
define ('LDAP_BASE','o=hosting,dc=example,dc=tld');

and change

// Welcome message
define ('SEND_WELCOME',1);
$welcome_msg = '../welcome_message.txt';
$welcome_subject = 'Welcome!';
# $welcome_sender = '[email protected]';
$welcome_bcc = '[email protected]';

This will send a welcome message and a bcc to your postmaster account.

Enable the fpt and person plugin by removeing the // in the plugins section. If wanted you can also enable the davical and or jabber plugins, the schema needed for these plugins is installed.

Change define ('ENC_TYPE','CRYPT');


define ('ENC_TYPE','MD5');

Since the transport maildrop: is hardcoded in phamm we need to change this in order to enable Dovecot delivery.

vi plugins/mail.xml

Replace each entry with maildrop: with dovecot: (do no forget the colon). In ordinary situations, the commands in Postfix's would do (that we added before), but ldap transport as used and implemented by phamm overrides this and implements maildrop.

That's it for the configuration.

You can edit plugins/mail.xml to change the defaults for smtp and quota, modify them to your needs.

You can edit plugins/ftp.xml to change the defaults for default ftp (base) directory and quota, modify them to your needs.

Do not forget to create the aliases and or mailboxes for postmaster, webmaster since these are used by official's and ISP's to send mail to in case of ... Not having these addresses could result in being blacklisted.

This concludes the phamm configuration.

Share this page:

0 Comment(s)

Add comment

Please register in our forum first to comment.


By: Miguel