iredmail-doc/html_bk/sql.add.alias.domain.html

55 lines
3.1 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>SQL: Add an alias domain</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-add-an-alias-domain">SQL: Add an alias domain</h1>
<div class="toc">
<ul>
<li><a href="#sql-add-an-alias-domain">SQL: Add an alias domain</a><ul>
<li><a href="#what-an-alias-domain-is-used-for">What an alias domain is used for?</a></li>
<li><a href="#add-alias-domain-with-iredadmin-pro">Add alias domain with iRedAdmin-Pro</a></li>
<li><a href="#how-to-add-an-alias-domain-with-sql-commands">How to add an alias domain with SQL commands</a></li>
</ul>
</li>
</ul>
</div>
<h2 id="what-an-alias-domain-is-used-for">What an alias domain is used for?</h2>
<p>Let's say you have a mail domain <code>example.com</code> hosted on your iRedMail server,
if you add domain name <code>domain.ltd</code> as an alias domain of <code>example.com</code>, all
emails sent to <code>username@domain.ltd</code> will be delivered to user
<code>username@example.com</code>'s mailbox.</p>
<h2 id="add-alias-domain-with-iredadmin-pro">Add alias domain with iRedAdmin-Pro</h2>
<p>With iRedAdmin-Pro, you can simply add alias domain name in domain profile page,
under tab <code>Aliases</code>.</p>
<p>Screenshot:</p>
<p><img alt="" src="./images/iredadmin/domain_profile_alias.png" /></p>
<h2 id="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&gt; USE vmail;
-- Create alias domain `alias-1.com`
sql&gt; INSERT INTO alias_domain (alias_domain, target_domain) VALUES ('alias-1.com', 'example.com');
-- Create alias domain `alias-2.com`
sql&gt; INSERT INTO alias_domain (alias_domain, target_domain) VALUES ('alias-2.com', 'example.com');
</code></pre>
<p>That's all.</p><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>