Setup a Postfix Alias Email Account

Recently, my business had the need to create an email account for general inquiries. Since I’m currently the only employee, the email will be sent to me, but I’d like to publish a contact email address in some instances rather than my personal email address.

The email address I decided to publish rather than my own was contact@lakonacomputers.com. In order to avoid setting up an user account on the mail server for a user named contact (and creating a mail store for the user), I decided to create an alias for contact and set myself as the contact user. This way, when email is received by Postfix for contact, the email will be sent to my mail store in my user directory.

The Configuration

First check the main.cf file (located at /etc/postfix on my Ubuntu server) to find the alias file configured for Postfix. Look for the following lines.

alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases

This tell us where the aliases file is located, so we open the file and you will see something like this:

# /etc/aliases
mailer-daemon: postmaster
postmaster: jason
nobody: root
hostmaster: root
usenet: root
news: root
webmaster: jason
www: root
ftp: root
abuse: root
noc: root
security: root

I simply added contact: jason to the file and then run the newaliases command to inform postfix of the update of aliases file. Voila, now when messages are sent to contact@lakonacomputers.com, the message will be sent to my user.