[exim] redirect router 'data' confusion

Top Page
Delete this message
Reply to this message
Author: exim.ml@riotm.co.uk
Date:  
To: exim-users
Subject: [exim] redirect router 'data' confusion
I've been trying to get my head round the redirect router for the last
two days. I've gone over Phillip Hazel's book and the online
documentation, but I just don't 'get' it.

The part I am struggling with is the 'data' section. With the redirect
router you don't specify a transport, I'm fine with that. What I don't
understand is how the 'data' lookup actually decides the action to take
on a message?

I may be picking the wrong router for the job I want to do - but it's
probably fundamental that I understand the logic and action taken.

In my scenario I have multiple domains. In Postfix 'speak' I would have
called them Virtual domains as they are 'hosted' but a single host may
be dealing with multiple facets for them (handling mail/web traffic). In
Phillip's Exim book the meaning of 'Virtual Domains' is different and is
defined as 'a domain in which all the valid local parts are aliases for
other addresses' - this is confusing the eggs out of me, so please
forgive my terminology if it is incorrect.

As far as the redirect 'data' section is concerned, in it's most simple
example:

data = ${lookup{$local_part}lsearch{/etc/aliases}}

I would assume this would assign to 'data' the contents of the line
returned from /etc/aliases. But how does it transport it to a mailbox or
destination if it can't use a transport? I'm guessing that it is somehow
implied - but it's going clear over my head.

In my particular scenario I may have 40 or so 'hosted/virtual' domains.
What I would like to achieve is the ability to redirect these dependent
on data held in a MySQL database with the recipient email address as the
search key.

I guess I first populate a variable in the main section of the runtime
conf with a list of domains the server accepts mail for:

domainlist accepted_domains = mysql;select * from domains where
domain='$domain'

Then precondition the redirect router with:

domains = domainlist

The rough structure of the database in pseudo form would be:
email_address        final_destination            destination_type
------------------------------------------------------------------------
user@domain        1.2.3.4:25            direct to ip
user2@domain        /mailboxes/domain/user2        mailbox
user@otherdomain        host.otherdomain:2525        hostname lookup
user2@otherdomain    /mailboxes/otherdomain/user2    mailbox


I'm assuming that 'redirect' is the right way to do this, that may be an
incorrect assumption, but I'm struggling to see how I would redirect
based on the 'final destination' and how that 'data' is parsed to
transport it.

Further complication comes from the old gateway cherry that is
'recipient verification'. Potentially final destinations can remove
recipients and these changes may not reflect on my Exim gateway. This
could leave it in the position of accepting a message it thinks it has a
valid recipient for, and then having to bounce/backscatter it when it
finds it can't deliver it. I know there are a number of ways to work
with this, such as querying a final destination LDAP/AD - but this does
not fit well with small customers running things like MailEnable on
Windows. Postfix has a probing method with a short cache to deal with
this scenario and looking at the Exim docs it appears that it has a
similar recipient callout feature. Naturally I would like to roll this
into my solution giving SMTP 5xx for 'no such user' before taking
responsibility for the message as far as I possibly can.

I apologise for the long winded question, but if I could clear up in my
mind how the 'data' actually transports the mail, if it can query MySQL
instead of a local alias file and if it's even the right router for what
I need to do I would be most grateful for the input.