We help IT Professionals succeed at work.

Setting up Postfix E-Mail for Multiple Virtual Domains

Michael Worsham
Medium Priority
Last Modified: 2013-12-15
I currently run a SuSe Linux Server (V9.0) with Postfix, AmaViS & Spamassin. I have started hosting multiple web sites via Apache's virtual domain configuration and would like to offer e-mail support for those virtual domains as well. Anyone have the steps to do this under Postfix v2.0.14?
Watch Question


Here is a detailed guide, suitable for most major Linux distro.

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Michael WorshamCloud/Infrastructure Solutions Architect


The server environment has already been established and already home to several accounts. Having to reinstall Postfix and any portions of it would not be beneficial to the service I already offer. I don't offer webmail nor do I want to at this time.

I am looking for steps not requiring me to reinstall Postfix nor use a database to control the domains.  I already took a look at http://www.postfix.org/VIRTUAL_README.html, but it really doesn't show good examples of a straight virtual domain setup.


You don't have to reinstall anything. You just need to make reference to the various configuration in the tutorial and configure yours. The tutorial shown above is a step-by-step guide.

You need courier-imap or other pop3 package that supports virtual domain.

Amavis + Spamassassin + Clamav is on another page of that site. Check the links on the left.

Michael WorshamCloud/Infrastructure Solutions Architect


It seems those instructions are geared to using the MySQL database for aliases, Cyrus-SASL for SMTP-Auth and SquirrelMail. I am looking to see what I need to do to alter my main.cf and the /etc/postfix/virtual code to handle virtual domains.

If I have to resort to having to have Postfix + MySQL + Cyrus-SASL + Courier-IMAP (as per those instructions) then I just won't offer e-mail for virtual domains and keep it as is. I just wanted to see if its possible w/o having to add in more packages and do a little bit of shell script work to have it operational.

-- Michael


You do not need MySQL and can make use of the system account. A few years ago I have tried that, and unfortunately, the character "@" is not accepted as part of a user account, so cannot create user account using their email address. Need to substitute "@" with something else, such as "#", and tweaking around to get the mailbox finally working. MySQL is used, for easy administration, scalablity and interoperability. You can make use of the same MySQL server for dynamic web content too. Anyhow, it can be done without MySQL, only more complicated, more difficult to maintain.

If you do not have a POP3 server that support virtual domain, how the user read their mail? So Courier-IMAP is in the picture. You need to authenticate the user when they are using SMTP as well as POP3/IMAP, and it is better for them to authenticate using the same piece of information (same userid and password), therefore, SASL is in the picture. If you find another simpler way for this, then, you don't need SASL.

You can just ignore the webmail part, it is completely optional.

Michael WorshamCloud/Infrastructure Solutions Architect


After reading all of the above, I believe the only way to win would be to start over from scratch. The option in the weblink given above really doesn't allow for exceptions to the rule for setting up virtual domains for e-mail accounts. Sort of sucks really, knowing that you cant just modify a couple of files and have it work -- still with ease of not using MySQL, SASL, etc. It seems Postfix has to rely on 3rd party applications to intergrate it for virtual domains for ease of use and setup.

I am going to keep the question open to see if someone else has a better method of not having to rely on additional 3rd apps to be installed for virtual domain setups (i.e. POP3, IMAP, etc).
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.