Saturday, January 23, 2010

Postfix Aliases and Mailing List

SkyHi @ Saturday, January 23, 2010

You can create a text file in Postfix containing an alias email and several destination emails. There are two ways to implement aliasing and mailing list in Postfix depending on how it is configured.

For System Accounts

Your Postfix is configured to use system accounts if your configuration file has something like
mydestination = $mydomain
or sending to a non-existent account gives the error message
Recipient address rejected: User unknown in local recipient table
Edit /etc/aliases
1. Edit the file /etc/aliases. The file has the form
alias: address1,address2
If address has the same domain as yours, you can leave it out. Thus you can use the /etc/aliases file to alias an email address or to build a mailing list.
Terminal2. Type in the command newaliases in a terminal window. This will rebuild the aliases database file.

For Virtual Accounts

Your Postfix is configured to use virtual accounts if your configuration file has something like
virtual_mailbox_domains = $mydomain
or sending to a non-existent account gives the error message
Recipient address rejected: User unknown in virtual mailbox table
Create /etc/postfix/valias
1. Edit the file /etc/aliases. The file has the form
alias address1,address2
postmap /etc/postfix/valias
2. Generate the database file for valias using the command
postmap /etc/postfix/valias
postmap query /etc/postfix/valias
3. Test your database file using the command
postmap -q group@acme.local /etc/postfix/valias
Replace group@acme.local with a valid alias entry. You should see the destination emails.
Edit main.cf
4. Edit the file /etc/postfix/main.cf and add the line below to your virtual settings section
virtual_alias_maps = hash:/etc/postfix/valias

NoteIf you are using virtual accounts, instead of maintaining a text file containing the aliases and mailing list, it would be better if you can work with your virtual accounts source. See the links below for examples

To Test Postfix

Service Configuration1. Restart the Postfix service. But if you installed MailScanner, then restart MailScanner instead. This will immediately reload the aliases database file instead of after a few minutes.
Terminal2. You should now be able to send email to addresses found in your aliases file. See Test Postfix using Telnet and try using the alias email addresses.


REFERENCE

http://www.linuxmail.info/postfix-aliases-mailing-list/