iredmail-doc/html_bk/sql.bulk.create.mail.users....

73 lines
3.4 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>SQL: Bulk create mail users</title>
<link rel="stylesheet" type="text/css" href="./css/markdown.css" />
</head>
<body>
<div id="navigation">
<a href="https://www.iredmail.org" target="_blank">
<img alt="iRedMail web site"
src="./images/logo-iredmail.png"
style="vertical-align: middle; height: 30px;"
/>&nbsp;
<span>iRedMail</span>
</a>
&nbsp;&nbsp;//&nbsp;&nbsp;<a href="./index.html">Document Index</a></div><h1 id="sql-bulk-create-mail-users">SQL: Bulk create mail users</h1>
<div class="admonition warning">
<p class="admonition-title">Deprecated</p>
<p>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
<a href="./sql.create.mail.user.html">SQL: Create new mail user</a> instead.</p>
</div>
<p>iRedMail ships the shell script <code>tools/create_mail_user_SQL.sh</code> to help you
create many mail users quickly.</p>
<p>Sample usage:</p>
<ul>
<li>Create the mail domain name <code>example.com</code> with iRedAdmin first.</li>
<li>Bulk create mail users with the shell script:</li>
</ul>
<pre><code class="language-shell"># cd iRedMail-0.9.4/tools/
# bash create_mail_user_SQL.sh example.com user1 user2 user3
</code></pre>
<p>It will generate the plain SQL file <code>output.sql</code> in current directory, please
login to SQL server as root user, then import it. for example:</p>
<ul>
<li>MySQL or MariaDB:</li>
</ul>
<pre><code class="language-shell"># mysql -uroot -p
sql&gt; USE vmail;
sql&gt; SOURCE output.sql;
</code></pre>
<ul>
<li>PostgreSQL:</li>
</ul>
<pre><code># cp output.sql /tmp
# chmod +r /tmp/output.sql
# su - postgres
$ psql -d vmail
sql&gt; \i output.sql;
</code></pre>
<p>Notes:</p>
<ul>
<li>Default password is same as username. if you prefer to set a password for all
created users, please open the script and update variable <code>DEFAULT_PASSWD</code>
with new password and set <code>USE_DEFAULT_PASSWD='YES'</code>.</li>
<li>Password scheme is defined in variable <code>PASSWORD_SCHEME</code>, default is <code>SSHA512</code>.
<code>BCRYPT</code> is recommended on FreeBSD and OpenBSD.</li>
<li>Per-user mailbox quota is defined in variable <code>DEFAULT_QUOTA</code>, default is
<code>1024</code> (1024 MB).</li>
<li>Maildir path is hashed like <code>domain.ltd/u/s/e/username-20150929</code>. If you
prefer <code>domain.ltd/username/</code>, please set <code>MAILDIR_STYLE='normal'</code>.</li>
<li>Mailbox storage path is defined in variable <code>STORAGE_BASE_DIRECTORY</code>, default
is <code>/var/vmail/vmail1</code>.</li>
</ul>
<h2 id="see-also">See Also</h2>
<ul>
<li><a href="./ldap.bulk.create.mail.users.html">LDAP: Bulk create mail users</a></li>
</ul><div class="footer">
<p style="text-align: center; color: grey;">All documents are available in <a href="https://github.com/iredmail/docs/">GitHub repository</a>, and published under <a href="http://creativecommons.org/licenses/by-nd/3.0/us/" target="_blank">Creative Commons</a> license. You can <a href="https://github.com/iredmail/docs/archive/master.zip">download the latest version</a> for offline reading. If you found something wrong, please do <a href="https://www.iredmail.org/contact.html">contact us</a> to fix it.</p>
</div></body></html>