######################################################################
##                                                                  ##
##              EXIM MAIL TRANSPORT CONFIGURATION FILE              ##
##                                                                  ##
######################################################################


######################################################################
#                    MAIN CONFIGURATION SETTINGS                     #
######################################################################

#----------------------------------------------------------------------------
# Set the timeout for accepting a non-SMTP message, that is, the maximum
# time Exim waits when reading a message on the standard input. Zero =
# forever. [Default = 0]

accept_timeout = 15m

#----------------------------------------------------------------------------
# Configure Exim so that a message deliver delay warning is sent after 12h.
# The default is 24h.

delay_warning = 12h

#----------------------------------------------------------------------------
# Prevent system overload by placing an upper limit on the load average
# during which deliveries are attempted. [Default = unset]

deliver_load_max = 8

#----------------------------------------------------------------------------
# Set user & group under which to run most of the time.

exim_user = exim
exim_group = mail

#----------------------------------------------------------------------------
# Specify parsing rules for gecos field.

gecos_name = "$1"

gecos_pattern = "^([^,]*),"

#----------------------------------------------------------------------------
# Set exim to ignore failures to deliver error message

ignore_errmsg_errors = true
 
#----------------------------------------------------------------------------
# Specify your local domains as a colon-separated list here. If this option
# is not set, the qualify_recipient value is used as the only local domain.
# If you do not want to do any local deliveries, uncomment the following line,
# but do not supply any data for it.

# local_domains = "somewhere.somedomain"

#----------------------------------------------------------------------------
# Log the original recepients, before rewriting.

log_received_recipients = true

#----------------------------------------------------------------------------
# Log smtp result (verify remote delivery).

log_smtp_confirmation = true

#----------------------------------------------------------------------------
# Set message size limit, 4MB

message_size_limit = 4M

#----------------------------------------------------------------------------
# No local deliveries will ever be run under the uids of these users.

never_users = root:daemon:bin:lp:sync:shutdown:adm:halt:ftp

#----------------------------------------------------------------------------
# If you want Exim to support the "percent hack" for all your local domains,
# uncomment the following line. This is the feature by which mail addressed
# to x%y@z (where z is one of your local domains) is locally rerouted to
# x@y and sent on. Otherwise x%y is treated as an ordinary local part.

# percent_hack_domains=*

#----------------------------------------------------------------------------
# Specify your host's canonical name here. If this option is not set, the
# uname() function is called to obtain the name.

# primary_hostname = 

#----------------------------------------------------------------------------
# Specify the domain you want to be added to all unqualified addresses
# here. If this option is not set, the primary_hostname value is used.

# qualify_domain = 

#----------------------------------------------------------------------------
# If you want unqualified recipient addresses to be qualified with a different
# domain to unqualified sender addresses, specify the recipient domain here.
# If this option is not set, the qualify_domain value is used.

# qualify_recipient = 

#----------------------------------------------------------------------------
# Do not attempt immediate delivery if load is above this

queue_only_load = 6

#----------------------------------------------------------------------------
# Controls the maximum number of queue-running processes that the Exim daemon
# will run simultaneously.

queue_run_max = 8

#----------------------------------------------------------------------------
# Control which hosts may use us as relay host

# relay_domains = "*.localdomain"

#----------------------------------------------------------------------------
# Set the maximum number of parallel deliveries done from a queue run

remote_max_parallel = 4

#----------------------------------------------------------------------------
# Set order into which domains are sorted before delivery starts

# remote_sort = "*.localdomain"

#----------------------------------------------------------------------------
# Set maximum size of bounce message return to sender

return_size_limit = 20K

#-----------------------------------------------------------------------------
# Sets which hosts we don't do an ident on.

rfc1413_except_hosts = "*";
 
#----------------------------------------------------------------------------
# Control which hosts may use us as relay host

# sender_host_reject_relay = "!*.localdomain"

#----------------------------------------------------------------------------
# However, make sure that unqualified addresses are not now rejected as well

# sender_unqualified_nets = localdomain.0.0/netmask.0.0

#----------------------------------------------------------------------------
# Verify all senders

sender_verify = true

sender_verify_reject = true

#----------------------------------------------------------------------------
# Set maximum number of incoming connections

smtp_accept_max = 30

#----------------------------------------------------------------------------
# Set to only queue incomming messages if more than given number of
# simultaneous SMTP connections are received.

smtp_accept_queue = 10

#----------------------------------------------------------------------------
# Reserve SMTP connections for local domain (as in smtp_reserve_hosts).

smtp_accept_reserve = 6

#----------------------------------------------------------------------------
# Set connection backlog - anti denial of service 

smtp_connect_backlog = 10

#----------------------------------------------------------------------------
# Set load for reserved hosts

smtp_load_reserve = 5

#---------------------------------------------------------------------------- 
# Reserve connections for local domain hosts

# smtp_reserve_hosts = "*.localdomains"

#----------------------------------------------------------------------------
# Set mail spool directory

spool_directory = /var/spool/exim
 
#----------------------------------------------------------------------------
# If you are running Exim under its own uid (recommended), then you should
# set up that uid as a trusted user by de-commenting the following and
# changing the name if necessary.

trusted_users = exim

end



######################################################################
#                      TRANPORTS CONFIGURATION                       #
######################################################################

# This transport is used for local delivery to user mailboxes.

local_delivery:
  driver = appendfile;
  file = /var/spool/mail/${local_part},
  user = ${local_part}

# This transport is used for handling pipe addresses generated by alias
# or .forward files. It has a conventional name, since it is not actually
# mentioned elsewhere in this configuration file.

address_pipe:
  driver = pipe;
# ignore_status,
  return_output

# This transport is used for handling file addresses generated by alias
# or .forward files. It has a conventional name, since it is not actually
# mentioned elsewhere in this configuration file.

address_file:
  driver = appendfile

# This transport is used for handling autoreplies generated by the filtering
# option of the forwardfile director. It has a conventional name, since it
# is not actually mentioned elsewhere in this configuration file.

address_reply:
  driver = autoreply

# This transport is used for delivering messages over SMTP connections.

smtp:
  driver = smtp;
  command_timeout = 1m,
  connect_timeout = 10s
end



######################################################################
#                      DIRECTORS CONFIGURATION                       #
######################################################################

# This director handles aliasing using a traditional /etc/aliases file.

system_aliases:
  driver = aliasfile;
  file = /usr/exim/aliases,
  search_type = dbm

# This director handles forwarding using traditional .forward files.
# If you want it also to allow mail filtering when a forward file
# starts with the string "# Exim filter", uncomment the "filter" option.

userforward:
  no_verify,
  driver = forwardfile;
  file = .forward,
  filter

# This director matches local user mailboxes.

localuser:
  driver = localuser,
  transport = local_delivery;

end



######################################################################
#                      ROUTERS CONFIGURATION                         #
######################################################################

# This router routes to remote hosts over SMTP using a DNS lookup with
# default options.

lookuphost:
  driver = lookuphost,
  transport = smtp;

# This router routes to remote hosts over SMTP by explicit IP address,
# given as a "domain literal" in the form [nnn.nnn.nnn.nnn]. The RFCs
# require this facility, which is why it is enabled by default in Exim.
# If you want to lock it out, set forbid_domain_literals in the main
# configuration section above.

literal:
  driver = ipliteral,
  transport = smtp;

end



######################################################################
#                      RETRY CONFIGURATION                           #
######################################################################

# This single retry rule applies to all domains and all errors. It specifies
# retries every 15 minutes for 2 hours, then increasing retry intervals,
# starting at 2 hours and increasing each time by a factor of 1.5, up to 16
# hours, then retries every 8 hours until 4 days have passed since the first
# failed delivery.

# Domain               Error       Retries
# ------               -----       -------

*                      *           F,2h,15m; G,16h,2h,1.5; F,4d,8h

end



######################################################################
#                      REWRITE CONFIGURATION                         #
######################################################################

# End of Exim configuration file
