Home
Up

This page provides a few tips concerning Exim. An excellent (and better) summary is provided on HOW TO SEND E-MAIL THROUGH SHELL USING EXIM4.

Installation

exim4 is a meta-package. exim4-base, exim4-daemon-light and exim4-config need to be installed.

Configuration

Configuration files

Exim's configuration file is located in /etc/exim4/exim4.conf.template (for unsplit configuration) or in files in /etc/exim4/conf.d. However, usually, this configuration file is not directly created by the Exim administrator, but generated from macros generated by the answers provided to Debconf during:
dpkg-reconfigure exim4-config
All answers provided to Debconf are stored in a simple shell script in /etc/exim4/update-exim4.conf.conf. Those answers are read by the script update-exim4.conf, and compiled into Exim4 macros provided in the exim4.conf.template configuration file for the Exim daemon. Lots of Exim documentation is provided in /usr/share/doc/exim4. It is worth to gunzip and read:
$ gzip -dc /usr/share/doc/exim4/README.Debian.gz | less
In /etc/email-addresses, specify the outgoing emails of users on the host:
user: someone@isp.com
otheruser: someoneelse@anotherisp.com

Exim and Gmail

See this: https://wiki.debian.org/GmailAndExim4 My /etc/exim4/update-exim4.conf.conf looks like this:
dc_eximconfig_configtype='smarthost'
dc_other_hostnames=''
dc_local_interfaces='127.0.0.1'
dc_readhost=''
dc_relay_domains=''
dc_minimaldns='false'
dc_relay_nets=''
dc_smarthost='smtp.gmail.com::587'
CFILEMODE='644'
dc_use_split_config='false'
dc_hide_mailname='false'
dc_mailname_in_oh='true'
dc_localdelivery='mail_spool'
Make sure to disable IPv6 at the beginning of the configuration file /etc/exim4/exim4.conf.template, for example just after the exim_path:
exim_path = /usr/sbin/exim4
disable_ipv6 = true
Provide Gmail credentials in /etc/exim4/passwd.client like this:
*.google.com:myname@gmail.com:mypassword
*.gmail.com:myname@fmail.com:mypassword
Note that specifying smtp*gmail.com:myname@gmail.com:mypassword does not work. Make sure the file is readable by the exim daemon:
sudo chown root:Debian-exim passwd.client
sudo chmod 640 passwd.client

Exim commands

To start exim,
/etc/init.d/exim4 restart
To reload the configuration of exim:
# update-exim4.conf
# invoke-rc.d exim4 restart
To force exim to try again to send messages, frozen or not:
exim -qff
To view the quantity of messages in the queue:
sudo exim4 -bpc
To list all messages in the queue:
sudo mailq
To view undelivered messages:
exim4 -bpu
To display some statistics on messages sent:
sudo exim4 -bp | eximqsumm
To delete frozen message:
mailq | grep 'frozen' | awk '{print $3}' | xargs exim4 -Mrm 
To view the current activity of Exim:
$ sudo eximwhat
11284 daemon: -q30m, listening for SMTP on [127.0.0.1]:25
To display the configuration exim uses:
exim4 -bV
To check if a given option is enabled or not:
$ exim -bP disable_ipv6
disable_ipv6
In the example above, IPv6 is disabled. If no_disable_ipv6 appears, IPv6 is not disabled. To understand why a given message is not routeable:
exim -d+route+resolver -v -M MESSAGE-ID
where the message id is something like 1WZ4qE-0005vb-JJ To send a test email:
echo "test message" | mail -s "subject" youremail@blah.com

Troubleshooting

Have a look at log files in /var/log/exim4/mainlog.
2014-04-18 22:18:58 1WbFFS-0005ro-Fj <= xxx@gmail.com U=user P=local S=488
2014-04-18 22:18:58 1WbFFS-0005ro-Fj == xxx@gmail.com R=smarthost
T=remote_smtp_smarthost defer (-53): retry time not reached for any host
2014-04-18 22:19:29 Start queue run: pid=22565 -qff
2014-04-18 22:21:37 1WbFFS-0005ro-Fj gmail-smtp-msa.l.google.com
[173.194.67.108] Connection timed out
That warning message states that Exim simply can't connect to gmail-smtp-msa.l.google.com. Make sure you are able to telnet the host on port 587 from the Exim host (in particular check there is no firewall that blocks the port).
SMTP error from remote mail server after MAIL FROM:<> SIZE=2730: host
gmail-smtp-msa.l.google.com [173.194.66.108]: 530-5.5.1 Authentication
Required. Learn more at\n530 5.5.1
http://support.google.com/mail/bin/answer.py?answer=14257
Make sure you have this in the password credential file:
*.google.com:myname@gmail.com:mypassword
 *.gmail.com:myname@fmail.com:mypassword
while checking a list: failed to open /etc/exim4/passwd.client for linear search: Permission denied (euid=111 egid=117)
Make sure /etc/exim4/passwd.client is accessible by the exim daemon.