themactep

a collection of miscellaneous projects of Paul Philippov

Exim Useful Tips

Please note, I use themactep.com in examples. You might want to replace it with your own domain.

How to generate self-signed certificate for Exim4

$ sudo /usr/share/doc/exim4-base/examples/exim-gencert

How to check DKIM and SPF records for your domain

or send an email to check-auth@verifier.port25.com

How to disable IPv6 in Exim4 on Debian

# disable IPv6
disable_ipv6 = true
dns_ipv4_lookup = *

add this to the beginning of /etc/exim4/conf.d/main/01_exim4-config_listmacrosdefs, update configuration, and restart the service.

How to serve direct delivery for a particular domain along with a smarthost for rest

customdelivery:
  condition = ${if eq {${lc:$domain}} {themactep.com} {true} fail }
  driver = dnslookup
  transport = remote_smtp

or

customdelivery:
  condition = ${if eq {${lc:$domain}} {themactep.com} {true} fail }
  driver = manualroute
  transport = remote_smtp
  route_list = "* mail.themactep.com byname"

add this to /etc/exim4/conf.d/router/200_exim4-config_primary before smarthost entry.

How to check routing

# exim -bt -d test@themactep.com

How to resend frozen messages in exim4 queue

# exim -bp | grep frozen | awk '{print $3}' | xargs exim -v -M

How to remove a message from queue

# exim -Mrm {message-id}

How to debug Exim SMTP on a production server

Start Exim in debug mode

# exim -bd -d -oX 26

then in another terminal send an email

# swaks --to test@themactep.com --server localhost --port 26

(found at GuruBob's Blog)

How to check for TLS

# swaks -a -tls -q HELO -s themactep.com -au test -ap '<>'

How to fix Unrouteable address for a local domain with Gmail smarthost

Add your domain name and corresponding smtp server to the list of hubbed hosts

# echo 'themactep.com: smtp.gmail.com' >> /etc/exim4/hubbed_hosts

then change hubbed transport to smarthost to have SMTP AUTH

# sed -i 's/transport = remote_smtp/transport = remote_smtp_smarthost/' \
   /etc/exim4/conf.d/router/150_exim4-config_hubbed_hosts

(from Exim mail list)