1

Topic: how to add an alias address via cli?

==== Required information ====
- iRedMail version (check /etc/iredmail-release): 0.9.2
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): mysql
- Web server (Apache or Nginx):apache
- Linux/BSD distribution name and version:ubuntu-14.04.2
- Related log if you're reporting an issue:
====

How can i add an alias address via command line interface?
Because i am going to migrate a domain into iredmail. there are many  mail aliases ?

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2 (edited by zippydan 2015-06-25 03:04:28)

Re: how to add an alias address via cli?

yavuz.maslak wrote:

==== Required information ====
- iRedMail version (check /etc/iredmail-release): 0.9.2
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): mysql
- Web server (Apache or Nginx):apache
- Linux/BSD distribution name and version:ubuntu-14.04.2
- Related log if you're reporting an issue:
====

How can i add an alias address via command line interface?
Because i am going to migrate a domain into iredmail. there are many  mail aliases ?

You have to connect to the database and add them using SQL syntax.  Exact steps will depend on your DB.  Here are instructions for postgres running in Ubuntu

=================

connect to postgres db

# sudo -u postgres psql postgres

list databases

\list

  or

\l

connect to vmail database

\connect vmail

list tables in connected database

\dt

this is the magic line

INSERT INTO alias (address, goto, domain) VALUES (‘alias.email@alias.domain.com’, ‘main.account@primary.domain.com’, ‘alias.domain.com’);

=================
Here are some other SQL commands that might help you:

show column names and info

\d+ alias

view all aliases

SELECT * FROM alias;

view aliases for a specific main account

SELECT * FROM alias WHERE goto=‘main.account@primary.domain.com’;

view aliases for a specific domain

SELECT * FROM alias WHERE domain=‘alias.domain.com’;

delete an alias

DELETE FROM alias WHERE address=‘alias.email@alias.domain.com’;

3

Re: how to add an alias address via cli?

We have a tutorial for you:
http://www.iredmail.org/docs/sql.create.mail.alias.html