Exim as simple email sender

Exim as simple email sender

Exim is a message transfer agent (MTA) developed at the University of Cambridge for Unix and Linux systems. This cheatsheet includes a description of a very simple Exim configuration which could be used on servers only for sending e-mails.

Exim generally uses configuration file, found at /etc/exim4/exim4.conf. To use Exim as simple email sender, the configuration file should look like below:

domainlist local_domains = @ hostlist relay_from_hosts = 127.0.0.1 acl_smtp_rcpt = acl_for_receiving begin acl acl_for_receiving: accept hosts = : accept domains = +local_domains endpass accept hosts = +relay_from_hosts endpass deny message = relay denied begin routers external_domains_router: domains = !+local_domains ignore_target_hosts = 0.0.0.0 : 127.0.0.0/8 driver = dnslookup transport = remote_smtp_transport no_more local_domains_router: driver = accept check_local_user transport = local_delivery_transport cannot_route_message = unknown user no_more begin transports remote_smtp_transport: driver = smtp local_delivery_transport: driver = appendfile file = /var/mail/$local_part delivery_date_add envelope_to_add return_path_add group = mail mode = 0660 begin retry * * F,3h,15m; F,24h,1h; F,7d,6h

Below is a short explanation for each directive:

domainlist
Defines a domain list called local_domains which is used identifies the domains that are to be delivered on the local host. @ is the name of the current hostname. You can get this name using the command:

uname -n

hostlist
Defines a list is of hosts that permits relaying. In above config only the processes on the localhost are able to submit mail for relaying.

acl_smtp_rcpt
Specifies the name of Access Control List (acl) that are to be used during an incoming SMTP sessions. The name of the list is acl_for_receiving and it is defined in begin acl section.

routers
The section describes router configuration which are the modules in Exim that make decisions about where to send messages. Router configuration is splitted in 2 sections: for external and local domains.

transports
This section define mechanisms for delivering messages which is referenced from routers. This transport is used for delivering messages over SMTP connections.

retry
The retry section of the configuration file contains rules which affect the way Exim retries deliveries that cannot be completed at the first attempt. This causes any temporarily failing address to be retried every 15 mins for the first 3 hours, then at every hour for 24 hours, finally every 6 hours for next 7 days. If an address is not delivered after 7 days of temporary failure, it is bounced.

To see if everything works, save the configuration file, restart Exim and check the logs with following command:

tail -f /var/log/exim/mainlog Related Posts: