NOTE: You must be logged in as a member of the mailadmin group to modify the aliases on your Freedom server. The administrative user is a member of this group.
Before you start creating email aliases, it’s important to note that it is possible to associate more than one domain name with a single Freedom server. Doing so is called virtual hosting. When using email aliases on a Freedom server with multiple domain names, you may need to combine aliasing with virtual user tables. This and other special considerations are discussed later in this chapter.
Your Freedom server’s email aliases are defined in a file called aliases, which is located in your server’s /etc/mail directory. Email aliases can be managed either by editing this file directly, or by using the VAdmin Web interface. This section will focus on managing email aliases from the command line. For additional information on using VAdmin to manage email aliases, consult the VAdmin section of this guide.
To view the aliases currently defined on your Freedom account, Telnet or SSH to your server and issue the following commands at the command prompt:
> cd /etc/mail
> more aliases
Note that lines beginning with a # are comments, and have no effect on your server’s email aliasing.
Email aliases must be set up in the following format:
alias: destination
The alias can be any valid email name (a name that contains only a-z, 0-9, the underscore, dot, and dash characters). The destination can be either the username for an email account that is housed on your Freedom account, a complete email address for a domain that is not housed on your Freedom account, or even another alias on your Freedom account.
You MUST separate the alias from the destination with a colon ( : ). If you’re using an alias to forward mail to another alias or email account on the same Freedom server, DO NOT include the @ sign or the domain name. The alias name will be active for any and all domain names that you have associated with your Freedom server.
For example, suppose that the domain name of your Freedom server is abc.com, and that you want all mail sent to "dave@abc.com" to be forwarded to an existing email account at "dave123@isp.com." You would need to add the following line to your aliases file:
dave: dave123@myisp.com
As an exercise, create a sales alias for your Freedom account. Enter the following command at your Freedom account's command prompt:
> cd /etc/mail
You should now be in the directory that contains the aliases file for your Freedom account. Before editing any important file on your Freedom account, it’s a good idea to make a backup copy using the cp command. To do so, enter the following command at your Freedom account's command prompt:
> cp aliases aliases.bak
This creates a backup copy of your aliases file named aliases.bak, which you can copy back to aliases if you accidentally make a mistake.
To edit the aliases file, enter the following command:
> pico aliases
This will start the pico online editor and open the aliases file. Use the arrow keys on your keyboard to scroll to the end of the file, then add the following line to the end of the file:
sales: your_email_address
Substitute your_email_address with an email address that you currently use, another alias on your Freedom account (such as webmaster), or the username for a POP account that exists on your Freedom account (such as the main administrative account). At the end of the line, hit [ENTER] a couple of times. UNIX tends to be better behaved when it finds a hard return or two at the end of any text file. Finally, exit pico and save your changes by pressing Ctrl+X, Y, [ENTER].
Your new aliases file has now been saved, but your new alias is not yet active. Before your new aliases can take effect, you need to inform your Freedom account that the aliases file contains new information so it can load the information into its alias database.
To tell your server that you’ve updated your aliases file, enter the following at the command prompt:
> mailctl restart
If no error message appears, everything worked properly. If an error message does appear, you should reopen the aliases file, look for any errors, and then repeat the mailctl restart command.
Test your new alias by sending email to the address you just created. If you followed the exercise above, you could send an email to "sales@yourdomain.com," substituting yourdomain.com with your actual domain name, and it should arrive at the destination you indicated in the aliases file.