- Linux Training
- Desktop Tutorials
- Server Tutorials
|Postfix Mail Aliases|
|Server - Postfix|
Normally, Postfix delivers mail to the user directly. However, there are situations where you will want to create a local or remote alias. It is important for Postfix to be able to use the alias file on the server (/etc/aliases). To ensure that it is in a format that Postfx can use run the newaliases command:
Webmin will run this command as you make changes to the configuration.
When you click the link for aliases you will see the mapping should already have been created.
The alias file is created in a database that can be used both by Sendmail and Postfix. This has been done so that if you migrate from a Sendmail installation you will be able to move easily to Postfix and use the same aliases. The alias database is designated by the alias_maps parameter.
An important point to note is that the alias file is system dependent.
The alias_database parameter specifies the alias database that is built with the newaliaeses command. This configuration is separate from the alias_maps because the two may be different and alias_maps may be controlled by another program.
#alias_database = dbm:/etc/aliases
#alias_database = dbm:/etc/mail/aliases
alias_database = hash:/etc/aliases
#alias_database = hash:/etc/aliases, hash:/opt/majordomo/aliases
Some aliases may have been created. Here three aliases are listed. It is important to create an alias for root so Postfix does not send mail messages to the root user. This is a security setting in case someone sent malware to the root user.
How an Alias is Used
When you create an alias you are converting mail from one user to another user account. This method may be used to create an alias for one user or for an email list.
The alias file may contain several kinds of alias forms. Each form is followed by a colon. The first example is a one-to-one relationship. This is where you list a local user and then follow it with the mail account you want it to go to whether it is local or remote.
The name Mary_Thompson was converted to the local user mary.
The second example is a one-to-many relationship. Here you have one local user and then mail is then sent to a number of users that are all a part of a group.
tech: mary, john, fred
Here by sending an email to tech it actually sends to three users who are involved in tech. If you have a list of users you can create a file and then list one user on each line for a much larger list.
tech_users: :include: _ /usr/local/techlist
This email will convert to a list of users that was created in the techlist.
If you want the mail to one account to be dumped into no where use this formula.
This email nobody will send all mail to trash.
PHP Script may require the path to the script and the PHP executable.
“\php -q /usr/local/bin/email.php”
This email will actually send the email to interact with a program. Notice the pipe symbol which sends the email to the support program. This is typically a perl or bash script.
This allows you to transfer mail from a local user to a remote who has an account on a different mail server.
Note that names are not case-sensitive.
Once you have edited this file you need to rebuild that alias database with this command:
This tells the system and Postfix to rebuild the alias database and create a file called aliases.db. This aliases.db is a file that can be queried quickly by Postfix. This command is run by Webmin when you save and apply.