Looking at the vmail database of the iRedMail installation I see an alias_domain table which is currently empty.
Is it possible to add domain aliases with a MySQL query directly on the vmail.alias_domain table?
Looking at the vmail database of the iRedMail installation I see an alias_domain table which is currently empty.
Is it possible to add domain aliases with a MySQL query directly on the vmail.alias_domain table?
To use my Canadian .ca site as an alias to my .com site I would use something like.
mysql -uroot -p
mysql> USE vmail;
mysql> INSERT INTO alias_domain (alias_domain, target_domain) values ('mysite.ca', 'mysite.com');
I created a script to do the dirty work.
Cut and paste below into a file add_domain.sh, then chmod 755 the file and run it with ./add_domain.sh alias_domain target_existing_domain OR ./add_domain.sh list to list the existing domains.
#!/bin/bash # 2014 Aug 16 James Forte, Magna Computer Corp if [ "$1" == "list" ] then mysql vmail -e 'select * from alias_domain' exit 0 fi if [ $# -lt 2 ] then echo usage "$0: alias_domain target_existing_domain" exit 1 fi CREATED=`date +%Y-%m-%d` echo -e "\nScript assumes that .my.cnf has passwords in it\n" echo "Adding alias domain $1 to existing domain $2" mysql vmail -e "INSERT INTO alias_domain (alias_domain, target_domain, created, active) VALUES ('$1','$2','$CREATED',1);" exit 0