SQL: Bulk create mail users


This document is applicable to iRedMail-0.9.5-1 and earlier releases. If you're running iRedMail-0.9.6 or newer releases, please check tutorial SQL: Create new mail user instead.

iRedMail ships the shell script tools/create_mail_user_SQL.sh to help you create many mail users quickly.

Sample usage:

# cd iRedMail-0.9.4/tools/
# bash create_mail_user_SQL.sh example.com user1 user2 user3

It will generate the plain SQL file output.sql in current directory, please login to SQL server as root user, then import it. for example:

# mysql -uroot -p
sql> USE vmail;
sql> SOURCE output.sql;
# cp output.sql /tmp
# chmod +r /tmp/output.sql

# su - postgres
$ psql -d vmail
sql> \i output.sql;


See Also