Generating aliases

For some mail servers, Mailman must generate a data file that is used to hook Mailman up to the mail server. The details of this differ for each mail server. Generally these files are automatically kept up-to-date when mailing lists are created or removed, but you might occasionally need to manually regenerate the file. The ‘bin/mailman aliases’ command does this.

>>> class FakeArgs:
...     output = None
>>> from mailman.commands.cli_aliases import Aliases
>>> command = Aliases()

For example, connecting Mailman to Postfix is generally done through the LMTP protocol. Mailman starts an LMTP server and Postfix delivers messages to Mailman as an LMTP client. By default this is done through Postfix transport maps.

Selecting Postfix as the source of incoming messages enables transport map generation.

>>> config.push('postfix', """
... [mta]
... incoming: mailman.mta.postfix.LMTP
... lmtp_host: lmtp.example.com
... lmtp_port: 24
... postfix_map_cmd: true
... """)

Let’s create a mailing list and then display the transport map for it. We’ll send the output to stdout.

>>> FakeArgs.output = '-'
>>> mlist = create_list('test@example.com')
>>> command.process(FakeArgs)
# AUTOMATICALLY GENERATED BY MAILMAN ON ...
#
# This file is generated by Mailman, and is kept in sync with the ...
# file.  YOU SHOULD NOT MANUALLY EDIT THIS FILE unless you know what you're
# doing, and can keep the two files properly in sync.  If you screw it up,
# you're on your own.
<BLANKLINE>
# Aliases which are visible only in the @example.com domain.
<BLANKLINE>
test@example.com               lmtp:[lmtp.example.com]:24
test-bounces@example.com       lmtp:[lmtp.example.com]:24
test-confirm@example.com       lmtp:[lmtp.example.com]:24
test-join@example.com          lmtp:[lmtp.example.com]:24
test-leave@example.com         lmtp:[lmtp.example.com]:24
test-owner@example.com         lmtp:[lmtp.example.com]:24
test-request@example.com       lmtp:[lmtp.example.com]:24
test-subscribe@example.com     lmtp:[lmtp.example.com]:24
test-unsubscribe@example.com   lmtp:[lmtp.example.com]:24
<BLANKLINE>

Clean up

>>> config.pop('postfix')

Table Of Contents

Previous topic

Mailman queue runner control

Next topic

Starting and stopping Mailman

This Page