154 lines
6.6 KiB
HTML
154 lines
6.6 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
<title>SQL: Add a mail alias account</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;"
|
|
/>
|
|
<span>iRedMail</span>
|
|
</a>
|
|
// <a href="./index.html">Document Index</a></div><h1 id="sql-add-a-mail-alias-account">SQL: Add a mail alias account</h1>
|
|
<div class="toc">
|
|
<ul>
|
|
<li><a href="#sql-add-a-mail-alias-account">SQL: Add a mail alias account</a><ul>
|
|
<li><a href="#create-mail-alias-account-with-iredadmin-pro">Create mail alias account with iRedAdmin-Pro</a></li>
|
|
<li><a href="#create-mail-alias-account-with-sql-command-line">Create mail alias account with SQL command line</a></li>
|
|
<li><a href="#access-policy">Access policy</a><ul>
|
|
<li><a href="#how-to-assign-a-moderator">How to assign a moderator</a></li>
|
|
</ul>
|
|
</li>
|
|
<li><a href="#see-also">See also</a></li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
<div class="admonition warning">
|
|
<p class="admonition-title">Warning</p>
|
|
<ul>
|
|
<li>This document is applicable to iRedMail-0.9.7 and later releases.</li>
|
|
<li>Here's <a href="./sql.create.mail.alias-20170701.html">doc for iRedMail-0.9.6 and earlier releases</a>.</li>
|
|
</ul>
|
|
</div>
|
|
<h2 id="create-mail-alias-account-with-iredadmin-pro">Create mail alias account with iRedAdmin-Pro</h2>
|
|
<p>With iRedAdmin-Pro, you can easily add mail alias account by click menu:
|
|
<code>Add -> Alias</code> in main navigation bar.</p>
|
|
<p><img alt="" src="./images/iredadmin/maillist_create.png" /></p>
|
|
<h2 id="create-mail-alias-account-with-sql-command-line">Create mail alias account with SQL command line</h2>
|
|
<p>To create an mail alias account, you need to add SQL records in 2 sql tables.
|
|
for example: create a mail alias account <code>alias@mydomain.com</code> and forward emails
|
|
to two addresses <code>someone@gmail.com</code> and <code>someone@test.com</code>:</p>
|
|
<pre><code class="mysql">sql> USE vmail;
|
|
|
|
-- Create mail alias account
|
|
sql> INSERT INTO alias (address, domain, active)
|
|
VALUES ('alias@mydomain.com', 'mydomain.com', 1);
|
|
|
|
-- Forward email to 'someone@gmail.com'
|
|
sql> INSERT INTO forwardings (address, forwarding,
|
|
domain, dest_domain,
|
|
is_list, active)
|
|
VALUES ('alias@mydomain.com', 'someone@gmail.com',
|
|
'mydomain.com', 'gmail.com',
|
|
1, 1);
|
|
|
|
-- Forward email to 'someone@test.com'
|
|
sql> INSERT INTO forwardings (address, forwarding,
|
|
domain, dest_domain,
|
|
is_list, active)
|
|
VALUES ('alias@mydomain.com', 'someone@test.com',
|
|
'mydomain.com', 'test.com',
|
|
1, 1);
|
|
</code></pre>
|
|
|
|
<p><strong>NOTES</strong>:</p>
|
|
<ul>
|
|
<li>Please always use lower cases for email addresses.</li>
|
|
<li>If destination address is a mail user under domain hosted on localhost,
|
|
it must exist. Otherwise emails sent to alias account will be bounced after
|
|
expanded to destination addresses.</li>
|
|
</ul>
|
|
<h2 id="access-policy">Access policy</h2>
|
|
<div class="admonition attention">
|
|
<p class="admonition-title">Attention</p>
|
|
<p>Access restriction requires iRedAPD plugin <code>sql_alias_access_policy</code>,
|
|
please make sure it's enabled in iRedAPD config file
|
|
<code>/opt/iredapd/settings.py</code>.</p>
|
|
</div>
|
|
<p>You can restrict which senders are allowed to send email to this mail alias
|
|
account by adding proper policy name in SQL column <code>alias.accesspolicy</code>.
|
|
For example:</p>
|
|
<pre><code>sql> UPDATE alias SET accesspolicy='domain' WHERE address='alias@mydomain.com';
|
|
</code></pre>
|
|
|
|
<p>Available access policies:</p>
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
<th>Access Policy Name</th>
|
|
<th>Comment</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td><code>public</code></td>
|
|
<td>no restrictions</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>domain</code></td>
|
|
<td>all users under same domain are allowed to send email to this mail alias account.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>subdomain</code></td>
|
|
<td>all users under same domain and all sub-domains are allowed to send email to this mail alias account.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>membersonly</code></td>
|
|
<td>only members of this mail alias account are allowd.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>moderatorsonly</code></td>
|
|
<td>only moderators of this mail alias account are allowed.</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>membersandmoderatorsonly</code></td>
|
|
<td>only members and moderators of this mail alias account are allowed.</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<h3 id="how-to-assign-a-moderator">How to assign a moderator</h3>
|
|
<p>Moderators are email addresses stored in SQL table <code>alias_moderators</code>. With
|
|
iRedAPD-1.4.5 and later releases, it's ok to use <code>*@domain.com</code> as (one of)
|
|
moderator for all users under mail domain 'domain.com'.</p>
|
|
<p>To assign user <code>someone@gmail.com</code> and <code>someone@outlook.com</code> as moderator of
|
|
mail alias <code>alias@mydomain.com</code>:</p>
|
|
<pre><code>sql> INSERT INTO alias_moderators (address, moderator, domain, dest_domain)
|
|
VALUES ('alias@mydomain.com', 'someone@gmail.com', 'mydomain.com', 'gmail.com');
|
|
|
|
sql> INSERT INTO alias_moderators (address, moderator, domain, dest_domain)
|
|
VALUES ('alias@mydomain.com', 'someone@outlook.com', 'mydomain.com', 'outlook.com');
|
|
</code></pre>
|
|
|
|
<h2 id="see-also">See also</h2>
|
|
<ul>
|
|
<li><a href="./ldap.add.mail.list.html">Create mailing list for OpenLDAP backend</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>
|
|
<!-- Global site tag (gtag.js) - Google Analytics -->
|
|
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-3293801-21"></script>
|
|
<script>
|
|
window.dataLayer = window.dataLayer || [];
|
|
function gtag(){dataLayer.push(arguments);}
|
|
gtag('js', new Date());
|
|
|
|
gtag('config', 'UA-3293801-21');
|
|
</script>
|
|
</body></html> |