Postfix with Mysql virtual users


I would like to have the following configuration: postfix with mysql user authentication and mail configuration (users, aliases, quota,…) stored in Mysql.

I installed virtualmin on Ubuntu 7.04. Postfix and mysql are running. But I’m not sure I can enable the mysql user auth. without breaking the virtualmin add mail user function.
I only found this post about the same problem:

Anyway, I would like to be sure that the users of the hosted domains will not experience changes, especially about the login used: "".

I entend to follow these howtos: and
But will it break the virtualmin mail management system ?

I guess there’s is no problem to achieve the postfix/mysql configuration. And the authentification will run without problem. But will I be able to add users throught the virtualmin server administration ?
On the other hand, If it’s not safe to use postfix/mysql with virtualmin, what should I configure to get the “” as pop3 login?

Thanks for your help.

I am looking for an answer to this as well. I followed the same tutorials and would like to use mysql for my postfix configs…


thanks for your followup.
So, if I configure postfix to use mysql authentication and storage, it works but not with virtualmin.

This is quite useless if I have to handle all the mail administration away from the virtual server configuration…
Is there any other way to work with virtualmin templates and still have authentication with mysql storage ?

Sorry guys, we don’t support users stored in MySQL. We just don’t think it’s a very good idea at this time, frankly.

If you must use database-backed users, LDAP does work well and has good tools support, and reasonable performance (no database type of user is as fast as local user storage in passwd/shadow, except on a very large scale–like several thousand users). While MySQL tools support is improving, it’s still got a long way to go before it is as comprehensive or mature as the tools for LDAP (and local users). Standardization is also nearly non-existent at this stage and everyone implements things a little differently…so there need to be tons of configurable options…all of those are options that you can get wrong, and make your life harder.

What are you trying to accomplish that makes MySQL a better choice than local users or LDAP users? If it’s just to get @ in usernames, PLEASE stop right now! The problem of @ in usernames is completely orthogonal to where you store your users–they are in no way related.

Virtualmin fully supports usernames with Postfix. You just have to turn it on in the Server Template(s) ("Mail for domain section", option is labeled "Format for usernames that include domain") and set the Module Configuration in the "Defaults for new domains" section option labeled "Include domain name in usernames?" to "Always" and the "Domain name style in username" to "Full domain name".

Please don’t make your system vastly more complex, slower, more resource intensive, and harder to maintain, just so you can say the users are in MySQL! :wink:

Hi Joe,

Thanks for the reply. And I totally get your point.
There is absolutely no obligation to use Mysql, but my previous system was like that (anyway I’m open to change, and why not LDAP).

So I will update the template server to stick with the "" schema and everything will be fine.

Joe, I too am moving over a lot of existing users and would prefer to maintain format for email usernames if possible. I followed the instructions above and everything works for checking mail, but I’m only able to send mail by using the version of the username. Is this expected behavior or am I missing some configuration somewhere?

Howdy joeles,

saslauthd is fighting you. It doesn’t like user@domain.tld usernames either, but you can force it to allow them by adding -r to the configuration for it. How you do that depends on your OS. On Red Hat based systems, it’s the “FLAGS” field in /etc/sysconfig/saslauthd. On Debian and Ubuntu it’s in /etc/defaults/saslauthd, but it’s either OPTIONS or PARAMS (yeah, they can’t seem to make up their mind on Debian/Ubuntu).

Thanks, Joe. That did the trick.


I found this thread and managed to install my email perfectly because of it, thanks!

I have one probably silly question left however, is it possible to change already existing pop3 logins? I have quite a few people with logins like <name.domain> or even just <name> from earlier trials coughs and i want to change them all to <name@domain.tld> Is this possible without deleting them?


Nobody who can help me with this?