exim4: add hostname for local routing

These days, I was confused by exim4 behavior on debian:

# hostname
gurke2
# cat /etc/hostname
gurke2
# exim -bt herbert@gurke2
R: nonlocal for herbert@gurke2
herbert@gurke2 is undeliverable: Mailing to remote domains not supported

So, although the recipient herbert@gurke2 clearly should be treated as a recipient in the local domain (the local host is named gurke2), exim thinks that gurke2 is a remote domain.

After digging into the config files, I came across the options named local_domain and MAIN_LOCAL_DOMAINS, searched the web for these and found the solution in this thread. The dc_other_hostnames is the right place to add host names (or fully qualified domain names) that should be treated by exim’s local_user router. I set this to gurke2, reloaded the exim configuration, and tested again. It works:

# vi /etc/exim4/update-exim4.conf.conf
# cat /etc/exim4/update-exim4.conf.conf | grep dc_other_hostnames
dc_other_hostnames='gurke2'
# service exim4 reload
[ ok ] Reloading exim4 configuration files: exim4.
# exim -bt herbert@gurke2
R: system_aliases for herbert@gurke2
R: userforward for herbert@gurke2
R: procmail for herbert@gurke2
R: maildrop for herbert@gurke2
R: lowuid_aliases for herbert@gurke2 (UID 1000)
R: local_user for herbert@gurke2
herbert@gurke2
  router = local_user, transport = mail_spool