This commit is contained in:
Zhang Huangbin 2020-09-21 15:04:27 +08:00
parent 5d038a8192
commit 72ebc6bdec
2 changed files with 35 additions and 4 deletions

View File

@ -8,8 +8,9 @@
instead.
iRedMail ships the shell script `tools/create_mail_user_SQL.sh` to help you
create new mail user quickly. With some shell scripting trick, it's easy to
create many mail users.
create new mail user quickly.
## Create a new mail user
Sample usage:
@ -63,6 +64,23 @@ Notes:
* Mailbox storage path is defined in variable `STORAGE_BASE_DIRECTORY`, default
is `/var/vmail/vmail1`.
## Create multiple mail users
With some shell scripting trick, it's easy to create many mail users. Just run
the script multiple times, but append the output SQL commands to same file.
```
# Create first user. With '>' to create or truncate file `/tmp/users.sql`.
bash create_mail_user_SQL.sh user1@domain.com 'password' > /tmp/users.sql
# Append users. With '>>' to append to `/tmp/users.sql`.
bash create_mail_user_SQL.sh user2@domain.com 'password' >> /tmp/users.sql
bash create_mail_user_SQL.sh user3@domain.com 'password' >> /tmp/users.sql
bash create_mail_user_SQL.sh user4@domain.com 'password' >> /tmp/users.sql
```
Then import `/tmp/users.sql` once to create them all at the same time.
## See Also
* [LDAP: Bulk create mail users](./ldap.bulk.create.mail.users.html)

View File

@ -24,8 +24,8 @@ tutorial <a href="./sql.bulk.create.mail.users.html">SQL: Bulk create new mail u
instead.</p>
</div>
<p>iRedMail ships the shell script <code>tools/create_mail_user_SQL.sh</code> to help you
create new mail user quickly. With some shell scripting trick, it's easy to
create many mail users.</p>
create new mail user quickly.</p>
<h2 id="create-a-new-mail-user">Create a new mail user</h2>
<p>Sample usage:</p>
<ul>
<li>Create the mail domain name <code>example.com</code> with iRedAdmin first.</li>
@ -77,6 +77,19 @@ sql&gt; \i output.sql;
<li>Mailbox storage path is defined in variable <code>STORAGE_BASE_DIRECTORY</code>, default
is <code>/var/vmail/vmail1</code>.</li>
</ul>
<h2 id="create-multiple-mail-users">Create multiple mail users</h2>
<p>With some shell scripting trick, it's easy to create many mail users. Just run
the script multiple times, but append the output SQL commands to same file.</p>
<pre><code># Create first user. With '&gt;' to create or truncate file `/tmp/users.sql`.
bash create_mail_user_SQL.sh user1@domain.com 'password' &gt; /tmp/users.sql
# Append users. With '&gt;&gt;' to append to `/tmp/users.sql`.
bash create_mail_user_SQL.sh user2@domain.com 'password' &gt;&gt; /tmp/users.sql
bash create_mail_user_SQL.sh user3@domain.com 'password' &gt;&gt; /tmp/users.sql
bash create_mail_user_SQL.sh user4@domain.com 'password' &gt;&gt; /tmp/users.sql
</code></pre>
<p>Then import <code>/tmp/users.sql</code> once to create them all at the same time.</p>
<h2 id="see-also">See Also</h2>
<ul>
<li><a href="./ldap.bulk.create.mail.users.html">LDAP: Bulk create mail users</a></li>