Import email account from MySQL 4.x to MySq 5.x?


I have a few hundred email accounts from our old dmail mail server using postfix/mysql 4 and I need to import them to the current virtualmin installation. Is it possible to dump and then import them without losing password and/or alias’s? If possible, can someone please point me in the right direction?

Thank you<br><br>Post edited by: nomadman, at: 2008/06/27 04:45

Bulk actions are easy (and there are a couple of ways to do it in Virtualmin–both command line and the GUI have batch capabilities).

Passwords are the hard part. Are they encrypted on your old system? If so, are they encrypted via either MD5 or crypt? If it’s any other format, you’re probably out of luck, since those are the only two formats you can drop into /etc/shadow.

Hi Joe,

The passwd is encrypted in crypt. Is there a tutorial I’ve overlooked in the wiki explaining how to migrate mail from one server to another? I think I have all the prerequisites in order to migrate from the old system. Can you please point me in the right direction to a tutorial? Are bulk actions available in the GPL version?

Thank you

No tutorials that I’m aware of.

The batch import mode in the GUI is currently only available in Virtualmin Professional, so you’ll need to use the command line option shown below (which is actually probably better for most cases where a lot of data is being dealt with).

The GUI batch import feature requires you to visit each virtual server and import each group of domains individually…so if you have hundreds of domains with one or two users each, you’re in for a world of pain using the GUI. Anyway (for anyone following along that does have Professional), to get there, and to see the help, browse to “Edit Mail and FTP Users” for the virtual server you want to work on, and click the “Batch create users”. Once on that form, you can click “Help…” to get complete information about the file format…it’s basically a passwd-style file (i.e. colon-delimited list), though the fields are different to accommodate the various available features. You can leave fields blank, for options you don’t need or care about.

The command line tool ‘‘’’ will allow you to write a simple shell script (or whatever language you like) to pull the data out of whatever your source is and act on it, based on whatever decisions need to be made to figure out which domain will contain which user. All of the command line tools now have good documentation thanks to a herculean effort by Jamie a few days ago:,virtualmin_api_create_user/

I’m pretty sure all of the basic ‘‘create-*’’ commands are available in GPL. If they aren’t, they should be…so let me know if you don’t have it, and I’ll make sure it gets into the next release (the rule we go by for the commands is: create, list, update, delete, actions go into GPL, while nothing more complex does…Professional has full command line coverage of every option in the UI in both command line and remote APIs).

Actually, now that I’m looking at the create-user docs…it looks like pre-crypted passwords aren’t going to work there. I’ll ask Jamie to chime in, as it seems like it’d be a pretty common use case to have pre-crypted or MD5 hashed passwords…and for almost every purpose, that’s OK.

Joe’s right - at the moment, there is no way to set a pre-encrypted password when using I will add this in the next release of Virtualmin though.

If you want this feature urgently, you can email me directly and I’ll send you an updated version of just that script.

Thanks for the prompt reply Joe and Jamie. Jamie, I’d like to work on the script over the weekend, so I would really appreciate it if you can email me the new one. It seams that I’m not able to find your email address or any type of PM option on this board. So if you can, please email me the script at rommel[at]

Sure, I will email it to you now …

Thank you Jamie. Thank you both for your assistance. I guess if I any questions about the new script, I’ll create it’ own tpic instead of coming back to this thread.

Thank you

HI Jamie,

I have a similar problem with encrypted passwords, could you please email me your latest version of the script to

Thanks very much for your time.

If you install Virtualmin 3.59 (which is now available), it already includes this script.