Note: These instructions are identical for Leopard and Snow Leopard.

To be able to store the e-mail for your users you have to setup a location that will be used on your servers harddisk. A very common location is ‘/usr/local/virtual‘, but you can put it anywhere you want. Keep in mind that if you use a different location that you need to change this location in the configuration files that we’ll create later on.

For lots of reasons that go beyond these instructions (security is the largest of them) we need to create a new user called ‘vmail’ on your server, this user account will be used by all programs to access the virtual mail folders. The user has no password or user directory.

sudo dscl . -create /Users/_vmail
sudo dscl . -create /Users/_vmail UserShell /usr/bin/false
sudo dscl . -create /Users/_vmail UniqueID 102
sudo dscl . -create /Users/_vmail PrimaryGroupID 102
sudo dscl . -create /Users/_vmail NFSHomeDirectory /var/empty
sudo dscl . -passwd /Users/_vmail ''

If you are installing for the first time the directory isn’t there yet. You need to create it and setup the correct permissions. So login to a Terminal session of your server and execute the following commands or use the shell script provided at the bottom of this page.

First create the required directory:

sudo mkdir /usr/local/virtual

Change the owner and group of the directory to be vmail so that the postfix program can read and write into that directory:

sudo chown -R _vmail:_postfix /usr/local/virtual

and setup the correct permissions
sudo chmod 771 /usr/local/virtual