Topic: Alias, forward, list ?
==== REQUIRED BASIC INFO OF YOUR IREDMAIL SERVER ====
- iRedMail version (check /etc/iredmail-release): 0.9.9
- Deployed with iRedMail Easy or the downloadable installer? Installer (a long time ago)
- Linux/BSD distribution name and version: debian 9
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): SQL
- Web server (Apache or Nginx):Nginx
- Manage mail accounts with iRedAdmin-Pro? no
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.
====
Hello,
I have finalised migration from 0.9.7 and the alias system got renewed.
I use to manage account with postfixadmin, but it's no longer an option without the aliases a they where.
I used the tools to migrate and it went smooth, all adresses work as before.
But i didn't fully understand the concept.
I found this post : https://forum.iredmail.org/topic13180-i … grade.html
Explaining a little what are the differences, but i still have some question.
I used aliases in the past, for mainly three cases :
1/ Old coworker, who had in the far past (not this server) an account tied to the domain but dont work here anymore and dont have mbox on this server.
2/ Pur aliases, for lets says microsoft activatio, that redirect ton one inbox, or to an external mailbox on another domain.
3/ Simple list, that redirect for multiple mailbox inside or outside this domain.
As I understand it, 1/ are now forwards, as 2/ but 3 are also to put in alias table
I made this script to help me create aliases :
#!/bin/bash
#
# create_alias.sh [alias@domain] [foward@domain]
#
# Reno31
#
sql_user="vmail"
sql_password="<YOUR OWN PASSWORD>"
if [ -z "$1" ]
then
echo "Usage :"
echo "create_alias.sh alias@domain.com forward1@domain1.com [forward2@domain.com ...]"
exit 1
fi
if [ $# -lt 2 ]
then
echo "Missing Params :"
echo "create_alias.sh alias@domain.com forward1@domain1.com [forward2@domain.com ...]"
exit 1
fi
alias=$1
shift
domain=$(echo ${alias} | awk -F\@ '{print $2}')
existing_mbox=$(mysql -u ${sql_user} -p${sql_password} -D vmail -NBse "SELECT username FROM mailbox WHERE username = '${alias}'")
if [ -z ${existing_mbox} ]
then
if [ $# -gt 1 ]
then
mysql1="INSERT INTO alias (address, domain, active) VALUES ('${alias}', '${domain}', 1);"
echo $mysql1;
fi
fi
for forward in "$@"
do
#echo ${forward}
existing_forward=$(mysql -u ${sql_user} -p${sql_password} -D vmail -NBse "SELECT username FROM mailbox WHERE username = '${forward}'")
#echo ${existing_forward}
#echo ${existing_mbox}
# more than one destinataire : is_list
if [ $# -gt 1 ]
then
sql_field="is_list"
# else both value are the same : is_forwarding
elif [[ "${existing_mbox}" = "${existing_forward}" ]]
then
sql_field="is_forwarding"
# else forward box exists
elif [ -n ${existing_forward} ]
then
#and alias dont : is_alias
if [ -z ${existing_mbox} ]
then
sql_field="is_alias"
#else it's forward
else
sql_field="is_forwarding"
fi
fi
forward_domain=$(echo ${forward} | awk -F\@ '{print $2}')
mysql2="INSERT INTO forwardings (address, forwarding, domain, dest_domain, ${sql_field}, active) VALUES ('${alias}', '${forward}', '${domain}', '${forward_domain}', 1, 1);"
echo $mysql2;
done
exit 0
Are input to submit to mysql produced by the script correct ( is_list, is_alias, is_forwarding ) ?
Also, if I for any reason decide to use what was a case 2/ for a case 3/, do I have to change in forward table all affected row from is_alias to is_list ?
----
Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.