Author Giuseppe Sacco
Date 2010-08-11
Title How to setup exim to route incoming emails to hylafax faxmail

This document assume that:
1. you have exim4 installed and running;
2. you selected your special fax domain as "fax.local"
3. you have exim4 with splitted configuration

Add this line in /etc/hylafax/hosts.hfaxd allowing Debian-exim user to connect
to hylafax without prompting for a password. Use hostname or ip address
depending on your DNS configuration. Please note that this line will accept
connection as Debian-exim user even if PAM is enabled in hylafax:

^Debian-exim@127\.0\.0\.1$:21::

Add to /etc/exim4/update-exim4.conf.conf your domain to dc_relay_domains as in:
   dc_relay_domains='myotherdomain.org:fax.local'

Create file /etc/exim4/conf.d/router/180_exim4-config_faxmail

### router/180_exim4-config_faxmail
#################################
# This router matches email sent to the hylafax domain fax.local
faxlocal_r:
  debug_print = "R: faxlocal_r for $local_part@$domain"
  driver = accept
  domains = fax.local
  transport = faxlocal_t

Create file /etc/exim4/conf.d/transport/30_exim4-config_faxmail

# This transport is used for handling pipe deliveries generated by
# router faxlocal_r. If the commands fails and produces any output on standard
# output or standard error streams, the output is returned to the sender
# of the message as a delivery error.
faxlocal_t:
  debug_print = "T: faxlocal_t for $local_part@$domain"
  driver = pipe
  return_fail_output
  path = "/bin:/usr/bin:/usr/local/bin"
  command = "/usr/bin/faxmail -n -s a4 $local_part"

Rebuild exim4 configuration and restart daemon:

# update-exim4.conf
# invoke-rc.d exim4 reload

