Szerző: Mike Cardwell Dátum: Címzett: exim users Tárgy: Re: [exim] Usage of dnsdb primary mx
Phil Pennock wrote:
>>> Is it possible to retrieve the highest prioritized MX record using a
>>> dnsdb lookup? If so, how?
>> The results returned by dnsdb when doing an mx or mxh lookup are not
>> ordered by priority:
>>
>> root@haven:~# exim4 -be '${lookup dnsdb{mx=googlemail.com}}'
>> 30 alt3.gmail-smtp-in.l.google.com
>> 40 alt4.gmail-smtp-in.l.google.com
>> 5 gmail-smtp-in.l.google.com
>> 10 alt1.gmail-smtp-in.l.google.com
>> 20 alt2.gmail-smtp-in.l.google.com
>> root@haven:~#
>>
>> I'm not sure how you could pick out the item with the lowest priority
>> using Exim expansions.
>
> ${reduce{<\n ${lookup dnsdb{mx=googlemail.com}}}{65535 .}{${if <{${extract{1}{ }{$item}}}{${extract{1}{ }{$value}}}{$item}{$value}}}}