LDAP: Bulk create mail users

iRedMail ships 2 scripts to help you create many mail users quickly.

Create mail users with create_mail_user_OpenLDAP.sh

# cd iRedMail-0.9.6/tools/
# bash create_mail_user_OpenLDAP.sh example.com user1 user2 user3

It will create users user1@example.com, user2@example.com, user3@example.com.

Note: you don't need to create the mail domain name example.com with iRedAdmin first.

Create mail users with create_mail_user_OpenLDAP.py

tools/create_mail_user_OpenLDAP.py will read mail accounts from a plain text file and generate a LDIF file, you can import this LDIF file to create mail users.

The plain text file format is:

domain name, username, password, [common name], [quota_in_bytes], [groups]

Note: domain name, username and password are required, others are optional.

3 examples:

mydomain.com, user1, plain_password, John Smith, 104857600, group1:group2
mydomain.com, user2, plain_password, Michael Jordan, ,
mydomain.com, user3, plain_password, , 104857600, group1:group2
# cd iRedMail-0.9.6/tools/
# python create_mail_user_OpenLDAP.py my_users.csv

It will generate a plain LDIF file my_users.csv.ldif under current directory, you can import it (after reviewed the LDIF data) with command ldapadd like below:

# ldapadd -x -D cn=Manager,dc=example,dc=com -W -f the_output_file.ldif


Additional Notes:

See Also