Simple Mailing Lists

Postfix provides the means to create simple mailing lists through the normal alias facility (see Chapter 4). Because aliases can point to lists of addresses or files that contain lists of addresses, it is easy to create an alias that points to multiple names. You can create list aliases in the system aliases file, or in any other file that you specify in the alias_maps parameter. See more about the alias_maps parameter later in the chapter. The default alias file when you install Postfix is /etc/aliases.

Let's suppose that you administer mail for the domain, and you want to create a new mailing list for people to discuss needlepoint. You decide to create a mailing list alias to be used for online discussions. Edit your alias file, and add the following line with the email addresses of people who want to subscribe to the list:


After making changes to the file, rebuild the alias lookup table by executing:

# postalias /etc/aliases

Now any messages sent to will be forwarded to each of the email addresses listed in the example.

10.1.1 Mailing-List Owners

If any messages cannot be delivered to one of the addresses listed, the original sender of the message receives an error message explaining that there was a delivery problem. For small or internal lists this may be perfectly acceptable; however, if you are creating a large list, or the members of the list do not necessarily know each other, it is probably more appropriate to have error messages sent to the administrator of the list. The convention is to create an additional alias for lists using a format like, where owner- is prepended to the name of the list alias. For the previous example, we would create the alias owner-needlepoint.[1] This owner- alias should point to an administrator, who is generally in a better position than the original sender to deal with bounced messages:

[1] Some MLM systems have adopted the convention of placing -owner after the alias instead of before.


Sending error notifications to the owner- alias is achieved by setting the envelope sender to the alias instead of the original sender's email address. Example 10-1 shows typical headers from a mailing-list message.

Example 10-1. Sample headers from mailing-list message

Received: from ([])
 by (Postfix) with ESMTP id B712120DD5B
 for  Mon, 13 May 2002 11:55:40 -0400 (EDT)
Date: Mon, 13 May 2002 12:00:43 -0400 (EDT)
From: G.M. Hopper 
X-Sender: gmhopper@cowrie
Subject: Just finished latest project

When the owner- alias exists, Postfix automatically uses it as the envelope sender address when sending out messages to list members. If, for some reason, you don't want Postfix to use the owner- alias but rather to keep the originator's address, you can set the parameter owner_request_special to no:

owner_request_special = no

You can also cause Postfix to use the actual administrator's email address instead of the owner- alias by setting expand_owner_alias to yes:

expand_owner_alias = yes

If this parameter is set, the address is used instead of

Although users do not generally need to send mail directly to the list owner, you should create owner aliases even for simple lists so other postmasters can contact the correct person in case they run into any problems with your list.

Another list convention is to provide a request alias for your lists. Request aliases use the format The request alias for the needlepoint alias looks like Request aliases are used for requests to subscribe and unsubscribe from lists or to get nontechnical information about a list.

10.1.2 Separate List Files

If you have more than just a few names on a list, it is more convenient to create a text file that lists all of the email addresses for the list. The format of the alias entry that points to a file is as follows:

email_alias: :include:/path/to/file.

Let's take the needlepoint alias from earlier in the chapter and move the list addresses into a separate file. Your alias entry should be revised to point to the text file that contains the list of addresses:

needlepoint: :include:/etc/postfix/needlepoint

The file /etc/postfix/needlepoint contains the email address of each member of the group. Put one address on each line. When you need to make changes to the list, simply edit the file:

I'm adding an invalid address,, for testing later in the chapter.

10.1.3 Additional Alias Files

Recall from Chapter 4 that the alias_maps parameter allows you to specify any number of alias files to use with Postfix. For example, you might want to use a separate alias file to store your mailing lists. Simply include the separate alias filename along with the system alias to set the alias_maps parameter. You should also set the alias_database parameter, so that you can run the command newaliases to update all of your alias-mapping files:

alias_maps = hash:/etc/postfix/aliases, hash:/etc/postfix/mail_lists
alias_database = hash:/etc/postfix/aliases, hash:/etc/postfix/mail_lists

It may be more convenient to assign all of your alias files to alias_database and then assign alias_database to alias_maps. If you use other map types for aliases, simply assign them to alias_maps as well:

alias_database = hash:/etc/postfix/aliases, hash:/etc/postfix/mail_lists
alias_maps = $alias_database, nis:mail.aliases

Remember to reload Postfix when you make changes to

10.1.4 Creating a Simple Mailing List

Let's review everything discussed so far and consider all the pieces of our needlepoint mailing list. The alias file contains the following lines:

needlepoint: :include:/etc/postfix/needlepoint

The first line in the example causes messages sent to to be delivered to every address listed in the /etc/postfix/needlepoint file. This file should contain a list of email addresses of all members of the list. Bounce messages and requests are forwarded to the real address If necessary, users or other postmasters can send messages to the list owner, and users can send messages to the request alias for subscription or other information.

When a message is sent to the list, the To: header contains just the address of the mail list alias and not an expansion of all the names on the list (which could be hundreds or even thousands of names). Each member of the list receives a copy of the message with headers that resemble those shown in Example 10-1. In this example, has sent a message to the list. Notice that the Return-Path: contains the owner alias rather than the actual originator of the message (

10.1.5 Testing Your List

You can test your list by sending a message to the alias you created for it. In this example, we'll use the list alias Example 10-2 shows the log entries for a sample test message. Imagine that the address is invalid.

Example 10-2. Log entries for message to astronomy mailing list

postfix/local[7411]: 6C2CE20DD5B: to=, 
 relay=local, delay=1, status=sent (forwarded as ACDC120DD70)
postfix/qmgr[8163]: ACDC120DD70: from=, 
 size=1121, nrcpt=8 (queue active)
postfix/local[0835]: ACDC120DD70: to= relay=local,
 delay=1, status=bounced (unknown user: "bogus")
postfix/smtp[6556]: ACDC120DD70: to=[], delay=1, 
 status=sent (250 Mail accepted)
postfix/smtp[6556]: ACDC120DD70: to=[], delay=1, 
 status=sent (250 Mail accepted)
postfix/smtp[5954]: ACDC120DD70: to=[], delay=1, 
 status=sent (250 Message received: GZCLUC00.E8F)

Some of the information, such as the timestamp and hostname, has been removed for clarity. Notice that at the end of the first line there is a comment saying (forwarded as ACDC120DD70) and the rest of the log entries use the new queue ID. Also notice in the first line of the example that the message enters the system addressed to The second line shows that Postfix uses the owner alias as the envelop sender address (from=) while delivering the message to all members of the list. The bogus address shows a status of "bounced." The address pointed to by the owner alias receives the bounce notification, which looks like Example 10-3. Notice in the example that the bounce notification message is delivered to The sender of the message does not receive a notification.

Example 10-3. Bounce notification for invalid address

From Tue Jul 16 12:03:49 2002
Date: Tue, 16 Jul 2002 11:25:27 -0400 (EDT)
From: Mail Delivery System 
Subject: Undelivered Mail Returned to Sender


: unknown user: "bogus"




Postfix Architecture

General Configuration and Administration

Queue Management

Email and DNS

Local Delivery and POP/IMAP

Hosting Multiple Domains

Mail Relaying

Mailing Lists

Blocking Unsolicited Bulk Email

SASL Authentication

Transport Layer Security

Content Filtering

External Databases

Appendix A. Configuration Parameters

Appendix B. Postfix Commands

Appendix C. Compiling and Installing Postfix

Appendix D. Frequently Asked Questions

Postfix(c) The Definitive Guide
Postfix: The Definitive Guide
ISBN: 0596002122
EAN: 2147483647
Year: 2006
Pages: 130
Authors: Kyle Dent D. © 2008-2020.
If you may any questions please contact us: