ConfigurationΒΆ

Response ships an example configuration file. Most of the options are heavily commented and others should be self-explanatory.

As stated in the list of features, all SQL queries may be customized.

#########################################################################
# The Response Project -- Configuration File                            #
#########################################################################
#
# INI format syntax primer :-)
#
# [SECTION-NAME]
#
# String options:
#   key = value
#   key = value continues on
#         lines starting with
#         whitespace
#   key = listitem1 listitem2 listitem3
#         listitem4 listitem5 ...
#
# Integer options:
#   key = value
#
# Boolean options:
#   key = False
#   key = True
#
# All options:
#   - no quotes
#   - leading whitespace is always stripped
#   - substitutions within the same section are supported, e.g.:
#       foo = bar
#       baz = /qux/%(foo)s/bax
#     results in:
#       baz = /qux/bar/bax
#

[LMTPD]

# TCP server socket we listen on. IPv4 only for now.
SOCKET_ADDR = 127.0.0.1
SOCKET_PORT = 10024

# Who may connect? Single IPv4 addresses only for now, whitespace separated.
SOCKET_ACL = 127.0.0.1

# Error Handling / Informing the client of problems
#
# Note: If all of the following options hardfail, softfail and failsafe
# are False the default behaviour if softfail.
#
# Hint: In the following comments, the "client" is the application
# speaking to us. This is most probably your MTA.

# Indicate an error to the client if we're unable to process the message.
# This will most probably result in a non-delivery status-notification
# issued by the MTA back to the sender!
# Note: Protocol-level errors (trying to use SMTP or unknown commands)
# will always cause a hard 5xx error-code pushed back to the client.
# Configure your client to connect to us using LMTP and run response-lmtp
# in debug mode to see protocol errors.
HARDFAIL = False

# Ask the client to re-send a message if we have problems?
# Note: This might cause a delivery-status-notification of type
# delayed issued by the MTA back to the sender, so be careful
# and configure your MTA accordingly!
SOFTFAIL = True

# Never inform the client of problems and silently discard/drop a
# message if we have problems processing it.
#
# Warning: Most importantly, this option will silently drop a message
# if the backend is unavailable (and hence will - if all validation
# would have been successful - result in a missing autoresponse).
# Use softfail if you want the MTA to try again later instead.
FAILSAFE = False


# Regular expression with named groups "user" and "domain",
# resulting in the real recipient address if joined with "@".
#
# Assume the original recipient is john@mydomain.tld:
#
# In case of Postfix, we silently create a copy of each message
# whose original recipient has configured and enabled an autoresponse.
#
# The internal recipient of this message is, for example:
#
#   john#mydomain.tld@response.internal
#
# The original @ was replaced by # and the new target domain is
# response.internal.
#
# This regexp is used for the reverse operation:
#
RECIPIENT_ADDRESS_REWRITE_RE = (?P<user>\S+)#(?P<domain>\S+)@


[BACKEND]

# Database adapter (see backend.py)
ADAPTER = MySQL
#ADAPTER = PostgreSQL # TODO

# How can we connect the database?
DATABASE_HOST = 127.0.0.1
DATABASE_PORT = 3306

# Credentials
USERNAME = response
PASSWORD = FIXME

# Database
#
# Note: this is currently used nowhere else in the code, only as a
# substitution in the following query definitions. If you want to use
# different databases for different queries, go for it.
DATABASE = response

# Should we do local recipient address validation?
# Note: For better performance this should be performed directly by the MTA,
# so it can evaluate if we are a suitable transport in the first place and
# save the whole overhead.  (sending the message to us, additional db
# connection...)
query_validate_recipient_enabled = False



#
# Example queries for the MySQL backend adapter
#

# Must return 1 if recipient is valid and has an enabled autoresponse
# configuration. Only needed if query_validate_recipient_enabled = True.
#
# Parameters:
#
#   address = E-Mail address of the local recipient
#
query_validate_recipient =
        SELECT
            1
        FROM
            `%(database)s`.`autoresponse_config`
        WHERE
            `address` = '%%(address)s'
        AND
            `enabled` = 1

# Query to insert a new or update an existing response record.
#
# Parameters:
#
#   date = Current date
#   sender = E-Mail address of the sender
#
query_record_response =
        INSERT INTO
            `%(database)s`.`autoresponse_record`
            (
                `sender_id`,
                `recipient`,
                `hit`
            )
        SELECT
            `id`             AS `sender_id`,
            '%%(recipient)s' AS `recipient`,
            '%%(date)s'      AS `hit`
        FROM
            `%(database)s`.`autoresponse_config`
        WHERE
            `address` = '%%(sender)s'
        ON DUPLICATE KEY
        UPDATE
            `hit` = '%%(date)s'

# Query to get pending responses.
#
# Parameters:
#
#   date = The latest sent-date back in history we require to send
#          another response. See NotifyConfig.required_timedelta.
#  limit = Upper limit of rows returned.
#
query_pending_responses =
        SELECT
            `record`.`id`           AS `id`,
            `config`.`address`      AS `sender`,
            `record`.`recipient`    AS `recipient`,
            `config`.`subject`      AS `subject`,
            `config`.`message`      AS `message`,
            `record`.`sent`         AS `sent`
        FROM
            `%(database)s`.`autoresponse_config` `config`,
            `%(database)s`.`autoresponse_record` `record`
        WHERE
            `config`.`id` = `record`.`sender_id`
        AND
            `config`.`enabled` = 1
        AND
            (
                `record`.`sent` = 0
             OR `record`.`sent` < '%%(date)s'
            )
        LIMIT %%(limit)d

# Query to update the sent timestamp of successfully sent responses.
#
# Parameters:
#
#     id = The id of the record.
#   date = The current date.
#
query_update_sent_timestamp =
        UPDATE
            `%(database)s`.`autoresponse_record` `record`
        SET
            `sent` = '%%(date)s'
        WHERE
            `record`.`id` = %%(id)d

# Query to disable autoresponders if they have expired.
#
# Parameters:
#
#   date = The current date.
#
query_disable_expired_configs =
        UPDATE
            `%(database)s`.`autoresponse_config` `config`
        SET
            `enabled` = 0
        WHERE
            `config`.`enabled` = 1
        AND
            `config`.`expires` < '%%(date)s'

# Query to delete old response records with no activity after the
# given date.
#
# Parameters:
#
#   date = The earliest hit-date back in history when we consider a
#          record to be deleted.
#
query_delete_old_response_records =
        DELETE
            `%(database)s`.`record`
        FROM
            `%(database)s`.`autoresponse_record` `record`
        WHERE
            `record`.`hit` < '%%(date)s'

# Query to delete records of disabled response configs.
#
# Parameters:
#
#   None
#
query_delete_records_of_disabled_configs =
        DELETE
            `%(database)s`.`record`
        FROM
            `%(database)s`.`autoresponse_record` `record`
        LEFT JOIN
            `%(database)s`.`autoresponse_config` `config`
        ON
            `record`.`sender_id` = `config`.`id`
        WHERE
            `config`.`enabled` = 0


[NOTIFY]

#
# Using a local sendmail binary
#

# TODO: Not implemented yet. Is it worth the effort?
# Let's use some real (E)SMTP relay!
# Use local sendmail command, if yes, which?
# sendmail_command = ['/usr/bin/sendmail', 'arg1', 'arg2', ...]


#
# Using a SMTP relay
#
SMTP_HOST = localhost
SMTP_PORT = 25
SMTP_TIMEOUT = 20

SMTP_AUTH = False
SMTP_USERNAME =
SMTP_PASSWORD =

SMTP_STARTTLS = False

# http://en.wikipedia.org/wiki/Envelope_sender
# This is the sender address given in the command channel of the SMTP protocol
# using "MAIL FROM". The null sender ("<>") is *strongly* recommended to avoid
# loops and other bad stuff!
SMTP_ENVELOPE_FROM = <>

# How many seconds must pass before we send a successive response from the
# same sender to the same recipient? (default: 1 week)
REQUIRED_TIMEDELTA = 604800


#
# Configuration of autoresponse message creation
#

# Message charset
MESSAGE_CHARSET = UTF-8

# Insert special headers to prevent other systems responding to our
# autoresponses? This is *strongly* recommended!
MESSAGE_INSERT_SPECIAL_HEADERS = True

# Set a realname to use in the "From" header.
MESSAGE_HEADER_FROM_NAME = Autoresponder

# Override the address in the "From" header of the response?  (The
# default is to use the e-mail address of the original local recipient)
MESSAGE_HEADER_FROM_ADDRESS =

# Prepend something to all subjects of all response messages?
MESSAGE_HEADER_SUBJECT_PREFIX =



[CLEANUP]

# Delete response records after the last hit is at least this old,
# in seconds. Used with -O, --delete-old-response-records.
# Note: This should be at least NofifyConfig.timedelta_required
DELETE_RECORDS_WITH_LAST_HIT_BEFORE = 604800

Response Project

Previous topic

Complete list of features

Next topic

Response documentation

This Page