I need to create alot of email aliases.
- On-Premise Server + WebMail Installations: Version 6.0 > Current Version
If you have many aliases you wish to define for Atmail then it can become tedious using the Webadmin UI. With this in mind we have created an easy to use CLI script to overcome the problem of bulk/batch adding of aliases into Atmail.
- Download the script from here. Then extract into place with the following command.
tar xvzf batch-alias-create.tgz -C /usr/local/atmail/webmailYou will then find the script located at/usr/local/atmail/webmail/utilities/tools/batch-alias-create.php
- The script usage is as such:
php batch-alias-create.php /path/to/csv
- The csv file should take the following format:
- Where alias-type can be either:
- Local - divert email from the address given in alias-name to the address/es given in forward-to
- Deliver - deliver to the address given in alias-name and also forward to the address/es in forward-to
- Domain - Catch all email going to the domain specified in alias-name and forward it to the address/es inforward-to
- Virtual - Forward all email from the domain in alias-name to the domain in forward-to
- MailDir - store any email's coming to the address in alias-name at the path defined by forward-to
- Where alias-name is either an email address or a domain name, depending on alias-type
- Where forward-to is either an email address, a list of email addresses (separated by a semi-colon ; ) or a domain name, depending on alias-type.
- Here is an example csv file:
- So the first line creates a MailDir Alias (as it is called in Webadmin) which stores any mail sent to firstname.lastname@example.org at /usr/home/brad/mail.
- The second line creates a "Deliver Locally and Alias" alias, which forwards a copy of any mail for email@example.com to firstname.lastname@example.org, email@example.com and firstname.lastname@example.org (it also delivers a copy to email@example.com). Notice that the forward-to addresses are separated by a semi-colon ( ; ) and not a comma ( , )
- The third line creates a "Local Alias", so that any email received for firstname.lastname@example.org is forwarded to email@example.com (you can specify multiple forward-to recipients, separated by a semi-colon ; )
- The fourth line creates a "Virtual Domain Alias" where any mail received for any user @testing.com is forwarded to that same user @test.com (so for eg. mail for firstname.lastname@example.org will be forwarded to email@example.com).
- The fifth line creates a "Domain" or "Catch All" alias, where any email sent to any user at cool.com is forwarded to firstname.lastname@example.org
This script is also very useful for creating mailing lists as described in this article.