Edited a link description. Added item about relay_domains.
Added item about alias_maps still required.
|Deletions are marked like this.||Additions are marked like this.|
|Line 42:||Line 42:|
|1. In most cases where you are doing this, it is still necessary to include hash:/path/to/data/aliases in alias_maps in main.cf because the transport_maps only say to use the local transport which still needs the aliases to deliver to Mailman.|
Mailman can also be additionally configured to automatically generate virtual alias mappings for postfix.
Some people find these features insufficient as they want to use some specific transport or other mapping for Mailman list addresses that is not applied to all addresses in the list domain(s). The following is a way to automate the generation of some Postfix map via editing the Mailman generated virtual-mailman file.
The following is not necessary if all that is desired is to have Mailman lists in a virtual_mailbox_domain. See this thread and this post on the mailman-users list and this example. However, the following or a similar procedure may still be useful to automatically generate transport_maps or some other mapping for Mailman lists for other purposes.
- Put the list domain(s) in POSTFIX_STYLE_VIRTUAL_DOMAINS in mm_cfg.py just as if they were going to be virtual_alias_domains.
- Do not put the domains in Postfix virtual_alias_domains, and do not put hash:/path/to/data/virtual_mailman in virtual_alias_maps.
- Create /path/to/data/virtual_to_transport with the following content
sed -r -e 's/(^[^#]\S+\s+).+$/\1local:/' $1 \ > /path/to/data/transport-mailman /usr/sbin/postmap /path/to/data/transport-mailman
Some non-GNU versions of sed require -E instead of -r to indicate extended regexps. Also, you can specify a transport other than 'local' by substituting its name for 'local' in the sed command above.
chgrp mailman /path/to/data/virtual_to_transport chmod 750 /path/to/data/virtual_to_transportIf your Mailman group is not 'mailman', put the actual group in the chgrp command.
POSTFIX_MAP_CMD = '/path/to/data/virtual_to_transport'in mm_cfg.py
Run Mailman's bin/genaliases. This will create/update the following files in /path/to/data/:
Make sure transport-mailman and transport-mailman.db have permissions like aliases and aliases.db. In particular, transport-mailman.db must be readable by Postfix. From now on, these files will be maintained automatically by Mailman as lists are created and deleted.
- Add "hash:/path/to/data/transport-mailman" to transport_maps in main.cf.
- In most cases where you are doing this, it is still necessary to include hash:/path/to/data/aliases in alias_maps in main.cf because the transport_maps only say to use the local transport which still needs the aliases to deliver to Mailman.
- Depending on your exact use case, it may be necessary to add the list domain(s) to relay_domains in main.cf.
- Reload Postfix to pick up the main.cf changes.