On Mon, 2010-04-19 at 13:55 +0100, John Burnham wrote:
> > Now the bit that has me stumped is how do I handle the situation for
> > recipients where I need to lookup the MX for their domain and for
> > literal IP addresses instead of hosts?
> >
> >
> > Looking at the literal IP issue first, I can't find any options on how
> > to route those. The 'route_data' option only appears to allow a host
> > list, not literal IP's. I could use any help on this as my reading of
> > docs and googling is not helping much here.
>
>
> Do you mean you're specifying an IP address for the host you wish to connect to ? That's perfectly valid:
>
> "Hosts may be listed by name or by IP address. An unadorned name in the list of hosts is interpreted as a host name. A name that is followed by /MX is interpreted as an indirection to a sublist of hosts obtained by looking up MX records in the DNS. For example:
>
> route_list = * x.y.z:p.q.r/MX:e.f.g
>
> If this feature is used with a port specifier, the port must come last. For example:
>
> route_list = * dom1.tld/mx::1225"
>
> so route_list = example.domain 1.2.3.4 is perfectly valid.
>
> If, instead you're talking about ip literals (ie foo@???) then have a look at the ipliteral router and note that you need to set allow_domain_literals = true in the main config section for them to work.
>
> >
> > As far as MX lookups are concerned, a couple of possible
> > options appear
> > in the docs, but I'm not sure if they are graceful, wasteful or plain
> > illegal.
> >
>
> Well, to make it do an MX lookup you have something like
> route_list = domain domain/mx
> (see example above) so I'd look to alter what your select returns to append /mx to the end. Does that make sense ?
>
> J
Thank you John.
I'm grateful to you as that has solved the literal IP issue - and
without the cost of an additional lookup.
The mx destination on the otherhand is still proving troublesome. Unlike
the example I'm not using route_list but route_data as in:
route_data = ${lookup mysql{SELECT relay_destination FROM mailusers
WHERE usertype=1 AND inbound=1 AND relay_type=0 AND active=1 AND
email='${quote_mysql:$local_part}@${quote_mysql:$domain}'}}/MX
And that bails with:
<munged@munged> cannot be resolved at this time: lookup of host "/MX"
failed in relay_to_mx router
or
<munged@munged> cannot be resolved at this time: lookup of host "/mx"
failed in relay_to_mx router
I've tried uppercase, lowercase, different position in the braces but
it's not playing nice. It's not really clear from the docs if the
route_list and route_data options are one and the same, but either I
have a typo, or the answer is 'no' :-( It would be such a graceful fix
too.