You need some administration tool to make the user management of your new mailserver a bit easier than typing a lot of SQL commands. Luckily there is an easy tool that allows simple administration of your virtual domains and mail users. It’s called Postfix Admin.
First you need to download the software package from the Postfix Admin site. Don’t use the installation guide that comes with the installation package as some of the steps you have already performed and might conflict with other parts of the installation.
Extract the package into the directory ‘/Library/WebServer/Documents‘, that is if you used our installation instructions. Otherwise extract it in the document root of your Apache installation.
For ease of use you can rename the directory ‘postfixadmin-2.2.x‘ to just ‘postfixadmin‘ or create a symbolic link to that directory as follows:
When you’ve done this you are ready to edit the configuration file. Edit the file ‘config.inc.php‘ and change following items:
$CONF['postfix_admin_url'] = ‘yourmaindomain.tld/postfixadmin’;
// how to connect to the database
$CONF['database_type'] = ‘mysql’;
$CONF['database_host'] = ‘localhost’;
$CONF['database_user'] = ‘postfixadmin’;
$CONF['database_password'] = ‘postfixadminpassword’;
$CONF['database_name'] = ‘postfix’;
$CONF['database_prefix'] = ”;
// your administrator e-mail address
$CONF['admin_email'] = ‘postmaster@yourmaindomain.tld’;
// The default aliases that need to be created for all domains.
$CONF['default_aliases'] = array (
‘abuse’ => ‘abuse@yourmaindomain.tld’,
‘hostmaster’ => ‘hostmaster@yourmaindomain.tld’,
‘postmaster’ => ‘postmaster@yourmaindomain.tld’,
‘webmaster’ => ‘webmaster@yourmaindomain.tld’
);
// to get a mailbox structure like /domain/user
$CONF['domain_path'] = ‘YES’;
$CONF['domain_in_mailbox'] = ‘NO’;
You need to do the final step by starting up your favourite browser and point it to ‘http://localhost/postfixadmin/setup.php‘. Your setup will be checked by the setup script and if everything is setup correctly you need to add a admin user. Type in your email address and make up a password and press the button.
when the admin user is added succesfully remove the setup.php file by using the following command:
You can then go into ‘http://localhost/postfixadmin/‘ to administrate your users and domain admins. Log in with your newly created admin account to add users and domains.
Next step: Securing your basic mailserver using TLS/SSL



1:39 am
in setup.php I got an error about not being able to connect to the database
fix:
sudo mkdir /var/mysql/
sudo ln -s /tmp/mysql.sock /var/mysql/mysql.sock
9:49 am
This isn’t recommended as the file will change after a reboot and that might break the link. It is better practice to change the configuration in the postfixadmin config or your php.ini to point to the correct socket.
7:25 pm
I had another problem where after putting in the login and password for the administrator user and clicking submit, Apache would crash (not fully, just the process serving me) and I would get an error in safari about the page being unavailable.
This was (seemingly) because I used the default Apache and PHP installed and didn’t compile my own from the guide on this page. At least that fixed the problem.
Also, there’s an error in the current (as of this writing) postfixadmin database checking script (upgrade.php) so that it stops at step 318. This is fixed by getting the latest version of that script from CVS (google the error for the link)
11:48 pm
When trying to start postfixadmin setup I received the following:
Invalid query: CREATE command denied to user ‘postfixadmin’@'localhost’ for table ‘config’
8:59 pm
Give the postfixadmin database user more rights on the postfix database, give it all the rights when possible.
9:54 pm
Postfixadmin needs php to be configured –with-imap, but when I try to configure php I receive an error;
checking for utf8_mime2text signature… new
checking for U8T_CANONICAL… no
configure: error: utf8_mime2text() has new signature, but U8T_CANONICAL is missing. This should not happen. Check config.log for additional information.
8:48 am
Postfixadmin will work without the imap plugin, but I’l see what I can do about this error. I will get back to you.
2:50 am
This error popped up when running setup.php. Normal?
Warning: Depends on: IMAP functions - NOT FOUND
To install IMAP support, install php5-imap
Without IMAP support, you won’t be able to create subfolders when creating mailboxes.
5:40 am
Jeff, I’m working on getting imap to work with PHP.
5:51 pm
Installed everything, tried to use postfixadmin and when I ran setup.php, the browser displayed this:
Safari can’t open the page “http://(domain name removed)/postfixadmin/setup.php”. The error was: “Operation could not be completed. (kCFErrorDomainCFNetwork error 302.)” (kCFErrorDomainCFNetwork:302) Please choose Report Bugs to Apple from the Safari menu, note the error number, and describe what you did before you saw this message.
Frustrating… any help?
6:17 pm
Followup: checking apache log gets this…
child pid 91216 exit signal Bus error (10)
6:22 pm
Please turn on PHP logging, you will see that there is an error occuring in the PHP code. Possibly databse user hasn’t got proper access rights or password incorrect.
3:49 am
Followed this guide up to hear and tried the “http://localhost/postfixadmin/setup.php” step and my browser says:
403 Forbidden
You don’t have permission to access /postfixadmin/setup.php on this server.
not exactly sure what I did wrong…