<h2id="how-to-add-an-alias-domain-with-sql-commands">How to add an alias domain with SQL commands</h2>
<p>Adding alias domain is as simple as inserting one SQL record. Let's create two
alias domains (<code>alias-1.com</code>, <code>alias-2.com</code>) for the primary domain
<code>example.com</code> with SQL commands below (Note: we use MySQL for example, but
PostgreSQL uses exactly same <code>INSERT</code> commands):</p>
<pre><code>-- Connect to `vmail` database.
sql> USE vmail;
-- Create alias domain `alias-1.com`
sql> INSERT INTO alias_domain (alias_domain, target_domain) VALUES ('alias-1.com', 'example.com');
-- Create alias domain `alias-2.com`
sql> INSERT INTO alias_domain (alias_domain, target_domain) VALUES ('alias-2.com', 'example.com');
</code></pre>
<p>That's all.</p><divclass="footer">
<pstyle="text-align: center; color: grey;">All documents are available in <ahref="https://bitbucket.org/zhb/iredmail-docs/src">BitBucket repository</a>, and published under <ahref="http://creativecommons.org/licenses/by-nd/3.0/us/"target="_blank">Creative Commons</a> license. You can <ahref="https://bitbucket.org/zhb/iredmail-docs/get/tip.tar.bz2">download the latest version</a> for offline reading. If you found something wrong, please do <ahref="https://www.iredmail.org/contact.html">contact us</a> to fix it.</p>
</div>
<!-- Global site tag (gtag.js) - Google Analytics -->