Postfix configuration exampleΒΆ

# Response configuration example for Postfix 2.5 and later.
#
# You have to *carefully* edit 4 files. Basic knowledge of the Postfix
# configuration file syntax is required. Read the syntax format primer
# in postconf(5) again if you're unsure.
#
# This configuration example suggests you do the first step of recipient
# validation (checking if an enabled autoresponse is available) directly
# with Postfix, not involving response-lmtp in any way if not. This will
# greatly improve performance in contrast to response-lmtp doing it, and
# is therefore the recommended way to go.
#
# To see this performance advantage, adjust the response backend
# configuration to contain (this setting is the default):
#
#   query_validate_recipient_enabled = False
#
#
# Note that this example makes use of recipient_bcc_maps to copy a message
# to response-lmtp. You are free to do that using virtual_alias_maps and a
# more complex database query, or whatever other variant is applicable in
# your case.



##########################################################################
# File 1:  /etc/postfix/master.cf
##########################################################################

# ========================================================================
# 1. Register the response transport. At the end of the file insert:
# ========================================================================
response  unix  -       -       n       -       4       lmtp
  -o disable_dns_lookups=yes

# Make sure that the second line starts with whitespace!


##########################################################################
# File 2:  /etc/postfix/transport_map_response
##########################################################################

# ========================================================================
# 1. Map a domain to the transport. You can use whatever you want here,
#    but make sure you re-use the left-hand side in the following steps.
#    The default literal "response.internal" is fine, though.
# ========================================================================
response.internal   response:[127.0.0.1]:10024

# -> Always run `postmap /etc/postfix/transport_map_response`
#    after changing / creating this file!



##########################################################################
# File 3:  /etc/postfix/recipient_bcc_map_response.mysql
##########################################################################

# ========================================================================
# 1. Instruct Postfix to send a copy of each message (to any valid
#    autoresponse-recipient) using the internal response transport.
#
# -> Make sure to adjust database credentials, database and table name!
# -> If you're using custom tables, make sure to adjust the query too.
# ========================================================================
hosts = mysql.db.mydomain.local
user = response
password = FIXME
dbname = response

query = SELECT '%u#%d@response.internal'
        FROM `autoresponse_config`
        WHERE `address` = '%s'
        AND `enabled` = 1



##########################################################################
# File 4:  /etc/postfix/main.cf
##########################################################################

# ========================================================================
# 1. Configure required limits for the transport
# ========================================================================

# Setting this parameter to a value of 1 changes the meaning
# of the corresponding per-destination concurrency limit from
# concurrency per domain into concurrency per recipient.
response_destination_recipient_limit = 1


# ========================================================================
# 2. Register our internal only response domain for the transport
# ========================================================================
transport_maps = hash:/etc/postfix/transport_map_response


# ========================================================================
# 3. Be sure to add $recipient_bcc_maps to the allowed $proxy_read_maps.
#
# -> This depends on your setup and whether you're using the virtual
#    features of Postfix. This example assumes you're using mysql lookup
#    tables in all of the $virtual_* lookup tables. It won't do no harm if
#    you don't, but for the sake of a correct configuration remove all
#    lookup-table lists from this setting that don't use a proxy driven
#    lookup-table, ie. mysql, pgsql, ldap, ...
# ========================================================================
proxy_read_maps =
        $virtual_alias_maps
        $virtual_mailbox_domains
        $virtual_mailbox_maps
        $recipient_bcc_maps


# ========================================================================
# 4. Finally, add the proxy mysql map for response to $recipient_bcc_maps.
# ========================================================================
recipient_bcc_maps =
        proxy:mysql:/etc/postfix/recipient_bcc_map_response.mysql



# Finally, reload Postfix: `postfix reload` and have an eye on the
# logfile while doing so, typically located in /var/log/mail.log.

Response Project

Previous topic

Response Installation

Next topic

Exim configuration example

This Page