#
# Configuration file for MailerQ application.
#
# See https://www.mailerq.com/documentation for the full documentation
#

# RabbitMQ configuration.
# Address of RabbitMQ broker, the format is:
# rabbitmq-address: amqp[s]://login:password@hostname/[vhost]
rabbitmq-address:           amqp://guest:guest@localhost/

# Verify amqps certificate, disable for self-signed certificate
rabbitmq-verify:            true

# The exchange to use for publishing. This can be an empty string to use
# the default exchange. The exchange will be createon startup.
rabbitmq-exchange:          

# Support for durable queues and persistent messages, to survive RabbitMQ
# crashes and restarts (persistent messages are very slow)
rabbitmq-persistent:        false
rabbitmq-durable:           true

# The "rabbitmq-lazy" setting toggles whether queues are declared as lazy
# queues. Lazy queues ensure that messages are always written to disk.
# This lowers overall performance, but prevents sudden performance drops
# once RabbitMQ needs to flush to disk, giving predictable performance.
# See the RabbitMQ documentation for more information on lazy queues.
rabbitmq-lazy:              false

# By default MailerQ declares all the queues it uses, if you want to declare
# the queues elsewhere, you can disable this feature.
rabbitmq-declare:           true

# Number of priorities supported by RabbitMQ queue. Used when declaring
# the queue. Cannot be changed on the already declared queues.
rabbitmq-maxpriority:       0

# Number of threads to use for consuming and publishing. These threads
# take a lot of resources because they also take care of compressing and
# decompressing. Raise this if you see "htop" output shows that these
# threads are your application bottleneck.
rabbitmq-consumers:         10
rabbitmq-publishers:        10

# The queues to use. Some can be left empty if you're not interested in the data.
#   - outbox:   message to be sent (mailerq consumes from this queue)
#   - inbox:    incoming messages (set to outbox to forward incoming mail)
#   - local:    incoming messages that match a local address
#   - refused:  incoming messages that were not accepted
#   - reports:  incoming messages holding a delivery report
#   - results:  all delivery results
#   - success:  subset of delivery results: just the successes
#   - failures: subset of delivery results: just the failures
#   - retry:    non-final failures (message that will be retried)
#   - dsn:      outgoing dsn messages (set to outbox to actually send dsns)
rabbitmq-outbox:            outbox
rabbitmq-inbox:             outbox
rabbitmq-local:             
rabbitmq-dsn:               outbox
rabbitmq-reports:           
rabbitmq-refused:           
rabbitmq-success:           success
rabbitmq-failure:           failure

# The content-encoding for data published to RabbitMQ (set to "gzip" to save
# bandwidth on internal network by compressing data that is sent to RabbitMQ)
rabbitmq-encoding:          identity

# Cluster configuration for communication between MailerQ instances. All MailerQ
# instances in the cluster need the same settings for these two variables!
cluster-address:            amqp://guest:guest@localhost/
cluster-exchange:           cluster

# Database configuration, needed to store runtime configuration settings.
# Also the reload-interval in seconds, the number of threads for DKIM dns
# lookups, and whether database integrity should be checked on startup.
database-address:           sqlite:///var/lib/mailerq/database.sqlite
database-ttl:               600
database-validate:          true

# Optional message store settings, to only send delivery meta data to RabbitMQ,
# and store the full content in a shared dir or nosql. Leave empty to disable.
storage-address:            
storage-threads:            5
storage-policy:             out
storage-ttl:                3600
storage-timeout:            20
storage-reschedule:         120

# Minimal management console configuration, with max number of connections
www-port:                   80
www-dir:                    /usr/share/mailerq/www
www-auth:                   hardcoded://mailerq:mailerq
www-connections:            100

# If you do not want the console on all IPs, but just a specific ip
www-ip:                     0.0.0.0

# The url is shared with the cluster, use if MailerQ fails to discover its own IP
www-url:                    

# Settings for https. This is highly recommended. You have to take care of
# getting your own private key and certificate.
www-secure-port:            
www-certificate:            
www-privatekey:             
www-ciphers:                !aNULL:!eNULL:!LOW:!SSLv2:!EXPORT:!EXPORT56:FIPS:MEDIUM:HIGH:@STRENGTH

# IP and port to which messages can be submitted
smtp-ip:                    127.0.0.1
smtp-port:                  25

# Settings to enable STARTTLS. Take care of your own key and certificate.
smtp-certificate:           
smtp-privatekey:            
smtp-ciphers:               !aNULL:!eNULL:!LOW:!SSLv2:!EXPORT:!EXPORT56:FIPS:MEDIUM:HIGH:@STRENGTH

# To open a port that is secure right away, with no need to STARTTLS
smtp-secure-port:           

# Limit access to the SMTP server. Only allow certain IP's and users access.
smtp-range:                 192.168.0.0/16;127.0.0.1
smtp-auth:          

# Incoming messages are normally sent out from the same IP. Use the following
# settings to control how incoming IP's are mapped to the outgoing IP.
smtp-default-ips:           
smtp-mappable-ips:          0.0.0.1/0
smtp-unmappable-ips:        127.0.0.0/8,192.168.0.0/16

# If you run MailerQ behind a Haproxy server with PROXY protocol, specify
# the IP addresses from which these connections come in.
smtp-proxy:                 

# Checks to perform on incoming messages, and whether to add the results
# only to json, or to the authentication-results header too.
smtp-check:                 
smtp-auth-results:          local

# Max size for incoming messages
smtp-maxsize:               100MB

# Extract "x-mq-*" headers from incoming messages
smtp-extract:               true

# Max number of SMTP connections
smtp-connections:           5000

# Max number of SMTP connections incoming
smtp-connections-in:        1000

# Max number of SMTP connections outgoing
smtp-connections-out:       4000

# Number of threads for SMTP traffic (incoming + outgoing)
smtp-threads:               10

# Port and ip settings of SpamAssassin (needed for spam score check)
spamassassin-host:          
spamassassin-port:          783

# Log for application information and errors
application-log:            syslog,/var/log/mailerq/mailerq.log

# Log of send attempts
send-bin-log:               /var/log/mailerq/send.bin
send-log:                   /var/log/mailerq/send.log
send-log-format:            [{$date}] {$result.state}:{$result.result} {$attempt} <{if $email.envelope}{$email.envelope}{/if}> <{$email.recipient}> [{$result.from}] [{$result.to}] {$email.tags} {$result.code} {$result.status} {$result.description}

# Log of downloads
download-bin-log:           /var/log/mailerq/download.bin
download-log:               /var/log/mailerq/download.log
download-log-format:        [{$date}] {$url}

# Log of incoming messages
received-bin-log:           /var/log/mailerq/received.bin
received-log:               /var/log/mailerq/received.log
received-log-format:        [{$date}]{if $json.message_id} {$json.message_id} {/if}<{$json.envelope}> <{$json.recipient}> [{$json.connection.remote_ip}] [{$json.connection.local_ip}]

# Log of management console
www-bin-log:                /var/log/mailerq/www.bin
www-log:                    /var/log/mailerq/www.log
www-log-format:             {$ip} [{$date}] ({$authentication}) {$request}

# Username to switch to after opening starting as root
user:                       mailerq

# Default max delivery time and max number of send attempts
max-delivertime:            86400
max-attempts:               100

# Delays between retries
retry-interval:             600,600,1800,1800,3600,3600,7200

# Lock file
lock:                       /tmp/mailerq.pid

# File that holds licensing information
license:                    license.txt

# SMTP sink to use for debugging (TCP connection will connect to this IP)
smtp-sink-address:          
smtp-sink-port:             
smtp-sink-username:         
smtp-sink-password:         

# Smarthost if all messages should be sent to to a different SMTP server
smarthost:                  
smarthost-port:             
smarthost-username:         
smarthost-password:         

# Settings for the DNS resolver
dns-buffersize:             1MB
dns-timeout:                5
dns-interval:               5
dns-attempts:               2
dns-capacity:               128
dns-sockets:                4
dns-rotate:                 false
dns-min-ttl:                

# Plugin directory
# plugin-directory:           /usr/share/mailerq/plugins

# Pickup directory where messages can be dropped
# spool-directory:            /usr/share/mailerq/spool
# spool-extract:              true
# spool-delay:                0
# spool-remove:               true
# spool-open-files:           10
# spool-threads:              1

# Options for generating Delivery Status Notifications (DSN)
dsn-advertise:              1
dsn-ret:                    HDRS
dsn-notify:                 NEVER

# Options that are used if MailerQ tries to download resources from the internet
download-cache:             directory:///tmp/downloads
download-blacklist:         127.0.0.1/24,192.168.0.0/24
download-whitelist:         
download-ttl:               36000

