1

I have exim4 configured to forward email for certain addresses.

The addresses are on virtual domains for which the server is the primary MX.

Other addresses on these domains are delivered to local mailboxes, but the addresses configured to forward go to external domains for which the server is not an MX and the mail should not be delivered to a local mailbox.

e.g. if the server is the primary MX for example.com, it should deliver mail locally for [email protected] but [email protected] should forward to [email protected].

All data for virtual domains and addresses is stored in MySQL.

The server OS is Debian.

The config for the forwarding router (in /etc/exim4/conf.d/router/400_exim4-config_mysql_forward is as follows:

mysql_forward:
  debug_print = "R: forwarder(mysql) for $local_part@$domain"
  driver = redirect
  no_verify
  no_expn
  check_ancestor
  forbid_smtp_code = true
  skip_syntax_errors
  domains = +local_domains
  data = ${lookup mysql{SELECT forward_to FROM mail_forwarders WHERE domain='${quote_mysql:$domain}' AND localpart='${quote_mysql:$local_part}' AND active=1} {${sg{$value}{\\n}{, }}}}

exim -bt [email protected] outputs something like:

R: forwarder(mysql) for [email protected]
R: dnslookup for [email protected]
[email protected]
    <-- [email protected]
  router = dnslookup, transport = remote_smtp
  host gmail-smtp-in.l.google.com      [74.125.133.27]  MX=5
  host alt1.gmail-smtp-in.l.google.com [173.194.222.27] MX=10
  host alt2.gmail-smtp-in.l.google.com [74.125.200.27]  MX=20
  host alt3.gmail-smtp-in.l.google.com [74.125.23.27]   MX=30
  host alt4.gmail-smtp-in.l.google.com [173.194.72.27]  MX=40

I can send mail with a local command and it is forwarded successfully.

However, when sending mail from an outside source, the mail is rejected with 550 Unrouteable address, e.g.:

telnet mailserver.example.com 25
Connected to mailserver.example.com.
Escape character is '^]'.
220 mailserver.example.com ESMTP
EHLO office.mylocaldomain.com
250-mailserver.example.com Hello office.mylocaldomain.com [21.22.23.24]
250-SIZE 52428800
250-PIPELINING
250 HELP
MAIL FROM: <[email protected]>
250 OK
RCPT TO: <[email protected]>
550 Unrouteable address
QUIT

I'm sure more config will be required to diagnose this fully. Please ask and I will provide.

1 Answer 1

0

This turned out to be the fault of no_verify in the router config. The docs recommend this setting for forwarders, but perhaps that is only appropriate when forwarding locally.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .