The basic mail-server setup is based on Postfix from Wietse Venema and the Courier IMAP and POP3 server. This mail-server is already included in the standard installation of Mac OSX Leopard but it lacks some important features if you want to receive mail from more than one user on different domains. To do that you need some more extensions and added features to de-couple the Postfix user management from the OS X user management, add some virtual domain handling, enable the users to send the mail securely over SSL and don’t open the server for abuse.
To be able to do this you need to compile Postfix with support for MySQL (user management), SASL (authentication), TLS (SSL) and use Courier IMAP (virtual mailboxes) or POP3 to have people look into their mailbox.
Building the components in 32 bits on Leopard:
- Building the Postfix mailserver in 32 bits on Leopard
- Building the Courier Auth library in 32 bits on Leopard
- Building the Courier IMAP/POP3 server in 32 bits on Leopard
Building the components in 64 bits on Leopard:
- Building the Postfix mailserver in 64 bits on Leopard
- Building the Courier Auth library in 64 bits on Leopard
- Building the Courier IMAP/POP3 server in 64 bits on Leopard
Configuring the components on Leopard:
When everything is build and installed you are ready to configure all the separate components before we can start it up. I will explain most of the configuration settings as we go along when possible.
- Setting up the database for mailserver administration
- Create the mailbox directories
- Configuring SASL for SMTP authentication
- Configuring Postfix for virtual domains using MySQL
- Configuring Courier-auth to use MySQL
- Configuring Courier IMAP with your maildir
Get everything running on Leopard:
Now everything is compiled and configured it is time to start everything up and to test if it’s working properly. This step also takes care of having everything start-up automatically after a reboot. Apache and MySQL have already been configured to start after a reboot now it’s time to take care of the mailserver components.
Note:
Many problems I received from people who tried this themselves didn’t start on a cleanly installed OS. They had multiple instances of MySQL installed or had some libraries left over from something else. You need to make sure where the include files and the libraries are of the MySQL installation you are going to use. You can find that out by running the ‘mysql_config’ command which will show you the location of the include files and libraries among some other things. If you used the MySQL.com installation package the output would look like:
Usage: /usr/local/mysql/bin/mysql_config [OPTIONS]
Options:
--cflags [-I/usr/local/mysql/include -Os -arch ppc -fno-common]
--include [-I/usr/local/mysql/include]
--libs [-L/usr/local/mysql/lib -lmysqlclient -lz -lm]
--libs_r [-L/usr/local/mysql/lib -lmysqlclient_r -lz -lm]
--socket [/tmp/mysql.sock]
--port [3306]
--version [5.0.19]
--libmysqld-libs [-L/usr/local/mysql/lib -lmysqld -lz -lm]
#
Next step: Building Postfix



12:21 am
Great information — your website is not just informative, you’ve done an outstanding job of detailing the steps.
Other than trying to sell OSX Server, is there any reason why Apple keeps breaking postfix?
7:42 am
@Elvis, Apple position on this is security. In being a workstation you don’t need to receive email which might turn your machine in a spam relay. they only turn of incoming mail but not the outgoing. You’re still able to send email from the local machine. The fix to this is very simple, I’ve learned the hard way that you need to check everything after each offical update or security patch.