To be able to store email2 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 ‘vmail2’ on your server, this user account will be used by all programs to access the virtual mail2 folders. The user has no password or user directory.

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

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.

First create the required directory:

sudo mkdir /usr/local/virtual

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

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

and setup the correct permissions

sudo chmod 771 /usr/local/virtual