Exim Operations Overview

This web page covers the Exim operations aspects, I will discuss in further details some of the topics here, I will provide the links to redirect you were necessary.

How Exim Identifies Messages

Each message handled by Exim is give a unique message ID when it is received, the ID is 16 characters long and consists of three parts.

Message ID

11uNWX-0004fP-a5

lluNWX = fractional part of unix time (number of seconds since 01/01/1970)
0004fP = ID of the process (pid) that received the message
a5     = fractional part of unit time (number of seconds since 01/01/1970)

You can use the option localhost_number (0-16) to distinguish different hosts in a cluster configuration, when used the host ID is incorporated into the third part of the message ID.

The Runtime Configuration File

Exim's runtime configuration file is a single text file, which you can modify using a favorite editor. When you change the file you need to reload it otherwise your changes will not be used

Determine the PID file # exim -bP |grep -i pid
Reread the config file

# kill -HUP `cat /var/spool/exim/exim-daemon-pid`
# kill -HUP `cat /var/run/exim/exim.pid`

The configuration is divided into seven sections

Main Section General option settings and overall input controls
ACL Section Access control lists
Routers Section Configuration for the routers
Transports Section Configuration for the transports
Retry Section Rules for specifying how often Exim is to retry temporarily failing addresses
Rewrite Section Global address rewriting rules
Authenticator Section Configuration for the SMTP authenticators

The Main section must always appear at the start of the file. The begin keyword is used to start a section (except for Main), these can be in any order and can even be omitted.

Exim uses a number of ways to set an option

Setting an option ## These are the same (setting to true)
split_spool_directory
split_spool_directory = true
split_spool_directory = yes

## These are the same (setting to false)
no_split_spool_directory
not_split_spool_directory
split_spool_directory = false
split_spool_directory = no

Exim uses time combination in options

Using Time

connect_timeout = 4m30s

Note: exim uses the following, but does no checking

w (week)
d (day)
h (hour)
m (minute)
s (second)

You can keep parts of the configuration in other files, then include them

include .include <filename>

Note: if the file does not exists then Exim reports an error
include_if_exists .include_if_exists <filename>

Note: if the file does not exists then Exim will not error

Exim can use macro facility, if a line in the main part of the configuration begins with an upper-case letter, it is taken as a macro definition, you can also redefine the macro at a later date

Macro example ALIAS_QUERY = select replacement from aliases where alias = '${quote_pgsql:$local_part}'

db_alias:
   driver = redirect
   data = ${lookup{$local_part}lsearch{/etc/aliases}{$value}{${lookup pgsql{ALIAS_QUERY}}}
Redefine a Macro

ALIAS_QUERY == select replacement from aliases where alias = '${quote_pgsql:$local_part}'

Note: you can also use the -D option on the commandline

You can use conditional statements regarding macro

Conditional Statement

.ifdef SMALL                      ## if macro SMALL is defined
   message_size_limit = 50M
   smtp_accept_max = 30
.else                             ## if macro SMALL is not defined
   message_size_limit = 100M
   smtp_accept_max = 60
.endif

Note: you can also use the following as well

.ifndef                           ## if macro is not defined
.elifdef                          ## standard else-if statement
.elifndef                         ## use the NOT for the else-if statement

For security you can hide options, thus stopping the command "exim -bP" from displaying values

Hiding Options hide mysql_servers = localhost/usertable/admin/secret

Exim can use lists as options, a list is separated by a colon.

Lists

local_interfaces = 127.0.0.1 : 192.168.0.1

local_interfaces = <; 127.0.0.1 ; 192.168.1        ## change the list separator to a ;

Named Lists domainlist local_domains = localhost : datadisk.co.uk
Using a List ## to use a list you must proceed it with a plus sign(+)

notlocal:
   driver = dnslookup
   domains = ! +local_domains      ## using the list above
   transport = remote_smtp
   no_more

You can specify a default domain, so if not domain is specified this will be used

default qualify domain qualify_domain = datadisk.co.uk

You can handle bounced messages by retaining them for a specific period

Retaining bounced messages

ignore_bounce_errors_after = 12h

Note: a bounced message will remain frozen for 12 hours before retry, if it fails again then it is discarded

You can reduce load on the system by using any of the following options

Delaying or suspending delivery when the load is high

queue_only_load = 8       ## if load is this high automatic delivery of incoming messages does not occur
deliver_queue_load = 14   ## the runners check if above the threshold if so the queue run is aborted

Suspending incoming mail when load is high smtp_load_reserve = 5                  ## setting the threshold
smtp_reserve_hosts = 192.168.24.0/24   ## only hosts from network can send mail
Controlling the number of incoming SMTP connections smtp_accept_max = 200                  ## limit the number of connections
smtp_accept_reserve = 40                 ## reserve number of slots for below networks
smtp_reserve_hosts = 192.168.24.0/24   ## uses the reserved slots above
Checking for free disk space check_spool_space = 50M   ## no mail can be received unless there is 50MB of free space

You can set the limit of a message size, which can be a good idea

Limit Message Size message_size_limit = 20M

You can control parallelism with the below option

Parallelism remote_max_parallel = 12   ## create 12 simultaneous remote delivery processes (multiple recipients)

You can control the number of processes that deliver messages

Delivery processes queue_only                 ## disable immediate delivery
queue_run_max = 15         ## specifies the maximum number of simultaneous active queue runners