help centre
For more info visit status.atmail.com

How can we help?


Search our knowledge base for answers to
common questions and latest updates.



My activities New request

Follow

Batch Creation of Aliases in Atmail

Stewart -

PROBLEM

I need to create alot of email aliases.

ENVIRONMENT

  • On-Premise Server + WebMail Installations: Version 6.0 > Current Version

CAUSE

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.

RESOLUTION

  1. Download the script from here. Then extract into place with the following command.
    tar xvzf batch-alias-create.tgz -C /usr/local/atmail/webmail
    You will then find the script located at/usr/local/atmail/webmail/utilities/tools/batch-alias-create.php
  2. The script usage is as such:
    php batch-alias-create.php /path/to/csv
  3. The csv file should take the following format:
    alias-type,alias-name,forward-to
  4. 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
  5. Where alias-name is either an email address or a domain name, depending on alias-type
  6. 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.
  7. Here is an example csv file:
    MailDir,brad@test.com,/usr/home/brad/mail
    Deliver,list@test.com,brad@test.com;brad@atmail.com;brad@domain.com
    Local,brad@nothere.com,brad@domain.com
    Virtual,testing.com,test.com
    Domain,cool.com,brad@test.com
    • So the first line creates a MailDir Alias (as it is called in Webadmin) which stores any mail sent to brad@test.com at /usr/home/brad/mail.
    • The second line creates a "Deliver Locally and Alias" alias, which forwards a copy of any mail for list@test.com to brad@test.com, brad@atmail.com and brad@domain.com (it also delivers a copy to list@test.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 brad@nothere.com is forwarded to brad@domain.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 brad@testing.com will be forwarded to brad@test.com).
    • The fifth line creates a "Domain" or "Catch All" alias, where any email sent to any user at cool.com is forwarded to brad@test.com

This script is also very useful for creating mailing lists as described in this article.

Have more questions? Submit a request

Comments


Contact our support team


+61 (7) 5357 6605       support@atmail.com