2016-05-19 06:51:20 -05:00
<!DOCTYPE html>
2014-09-30 10:13:21 -05:00
< html >
< head >
< meta http-equiv = "Content-Type" content = "text/html; charset=utf-8" / >
2015-02-01 05:22:03 -06:00
< title > SQL: Add a mail alias account< / title >
2015-07-31 23:14:52 -05:00
< link rel = "stylesheet" type = "text/css" href = "./css/markdown.css" / >
2014-09-30 10:13:21 -05:00
< / head >
< body >
2019-07-13 06:21:55 -05:00
2014-09-30 10:13:21 -05:00
< div id = "navigation" >
2017-11-16 21:48:44 -06:00
< a href = "https://www.iredmail.org" target = "_blank" >
2016-04-19 12:48:51 -05:00
< img alt = "iRedMail web site"
src="./images/logo-iredmail.png"
style="vertical-align: middle; height: 30px;"
/>
< span > iRedMail< / span >
< / a >
2016-02-29 02:15:19 -06:00
// < a href = "./index.html" > Document Index< / a > < / div > < h1 id = "sql-add-a-mail-alias-account" > SQL: Add a mail alias account< / h1 >
2015-02-01 05:22:03 -06:00
< 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 >
2017-07-02 21:02:07 -05:00
< 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 >
2015-02-01 05:22:03 -06:00
< li > < a href = "#see-also" > See also< / a > < / li >
< / ul >
< / li >
< / ul >
< / div >
2018-04-19 11:30:42 -05:00
< div class = "admonition warning" >
< p class = "admonition-title" > Warning< / p >
2017-07-02 21:02:07 -05:00
< 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 >
2015-02-01 05:22:03 -06:00
< h2 id = "create-mail-alias-account-with-iredadmin-pro" > Create mail alias account with iRedAdmin-Pro< / h2 >
2018-04-19 11:30:42 -05:00
< p > With iRedAdmin-Pro, you can easily add mail alias account by click menu:
< code > Add -> Alias< / code > in main navigation bar.< / p >
2017-10-28 00:38:13 -05:00
< p > < img alt = "" src = "./images/iredadmin/maillist_create.png" / > < / p >
2015-02-01 05:22:03 -06:00
< h2 id = "create-mail-alias-account-with-sql-command-line" > Create mail alias account with SQL command line< / h2 >
2017-07-02 21:02:07 -05:00
< 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 >
2014-09-30 10:13:21 -05:00
< pre > < code class = "mysql" > sql> USE vmail;
2017-07-02 21:02:07 -05:00
-- 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);
2014-09-30 10:13:21 -05:00
< / code > < / pre >
< p > < strong > NOTES< / strong > :< / p >
< ul >
< li > Please always use lower cases for email addresses.< / li >
2015-02-20 08:02:03 -06:00
< li > If destination address is a mail user under domain hosted on localhost,
2014-09-30 10:13:21 -05:00
it must exist. Otherwise emails sent to alias account will be bounced after
expanded to destination addresses.< / li >
2015-02-01 05:22:03 -06:00
< / ul >
< h2 id = "access-policy" > Access policy< / h2 >
2017-07-02 21:02:07 -05:00
< 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 >
2015-02-01 05:22:03 -06:00
< 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 >
2017-07-02 21:02:07 -05:00
< 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 >
2018-04-19 11:30:42 -05:00
< td > all users under same domain are allowed to send email to this mail alias account.< / td >
2017-07-02 21:02:07 -05:00
< / tr >
< tr >
< td > < code > subdomain< / code > < / td >
2018-04-19 11:30:42 -05:00
< td > all users under same domain and all sub-domains are allowed to send email to this mail alias account.< / td >
2017-07-02 21:02:07 -05:00
< / tr >
< tr >
< td > < code > membersonly< / code > < / td >
2018-04-19 11:30:42 -05:00
< td > only members of this mail alias account are allowd.< / td >
2017-07-02 21:02:07 -05:00
< / tr >
< tr >
< td > < code > moderatorsonly< / code > < / td >
2018-04-19 11:30:42 -05:00
< td > only moderators of this mail alias account are allowed.< / td >
2017-07-02 21:02:07 -05:00
< / tr >
< tr >
< td > < code > membersandmoderatorsonly< / code > < / td >
2018-04-19 11:30:42 -05:00
< td > only members and moderators of this mail alias account are allowed.< / td >
2017-07-02 21:02:07 -05:00
< / 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');
2015-02-01 05:22:03 -06:00
< / 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 >
2016-05-19 06:51:20 -05:00
< / ul > < div class = "footer" >
2019-09-06 00:54:43 -05:00
< p style = "text-align: center; color: grey;" > All documents are available in < a href = "https://github.com/iredmail/docs/" > BitBucket 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 >
2016-05-19 06:51:20 -05:00
< / div >
2017-11-05 02:33:58 -06:00
<!-- 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());
2015-02-05 07:02:53 -06:00
2017-11-05 02:33:58 -06:00
gtag('config', 'UA-3293801-21');
2014-10-13 19:28:43 -05:00
< / script >
< / body > < / html >