SQL: Add a mail alias account

Attention

Check out the lightweight on-premises email archiving software developed by iRedMail team: Spider Email Archiver.

Warning

Create mail alias account with iRedAdmin-Pro

With iRedAdmin-Pro, you can easily add mail list account by click menu: Add -> Mail List (or Add -> Alias for SQL backends) in main navigation bar.

Create mail alias account with SQL command line

To create an mail alias account, you can simply insert a SQL record in table vmail.alias. For example:

sql> USE vmail;
sql> INSERT INTO alias (address, goto, domain, islist) \
     VALUES ('original@example.com', \
             'user1@example.com,user2@example.com,user1@test.com', \
             'example.com', \
             1);

NOTES:

Access policy

You can restrict which senders are allowed to send email to this mail alias account by adding proper policy name in SQL column alias.accesspolicy. For example:

sql> UPDATE alias SET accesspolicy='domain' WHERE address='original@example.com';

Available access policies are:

Access restriction is implemented in iRedAPD (a simple Postfix policy server), iRedMail has it enabled by default. You'd better check its config file /opt/iredapd/settings.py to make sure plugin sql_alias_access_policy is enabled in parameter plugins = [].

See also