An email alias is a name that appears before the @ symbol in an email address, which actually refers to another account or location. For example, the alias “billing” may actually point to an email account on your server called “sales”. A single email account can have multiple aliases, and an alias can even point to an external email address (outside of your server).
Many modern web-based control panels allow web hosting users to easily create basic email aliases; however, as an administrator of a Linux dedicated server, you may occasionally need to create aliases manually. To create aliases, follow these steps.
1. Login to your server via SSH
ssh -lusername servername.com
2. Login as root
3. Edit the Postfix/Sendmail alias file:
4. Create an alias on a new line:
5. Save and exit.
6. Apply the changes:
In addition to mapping aliases to email accounts, you can also perform more advanced aliasing, such as piping emails to a file or script. Some web applications will require this, and your hosting clients may ask you to pipe a particular alias to a command or script. Follow the same procedure to edit the /etc/aliases file, but when you create the alias, make it look like this:
Now, all email sent to billing will be forwarded to the billing module script and processed by your billing web application. The possibilities are vast when dealing with email aliases. Try a few aliases and test the results. You will undoubtedly find it very useful in the future.