Re: iddnsresolver demo/examples??

Giganews Newsgroups
Subject: Re: iddnsresolver demo/examples??
Posted by:  Remy Lebeau (TeamB) (gambit47.no.spam@no.spam.yahoo.com)
Date: Thu, 30 Oct 2003

"Anthony" <antho…@n.o.s.p.a.m.caltec.co.uk> wrote in message
news:E9FF91E88E84E240antho…@n.o.s.p.a.m.caltec.co.uk...

> Is it just me or has the DNS resolver demo got major
> issues? like it wont compile. at all.

I would imagine that it is because it is an old demo from Indy v8 that has
not been updated for Indy v9.  TIdDNSResolver was re-written in Indy 9.

> All I want is a simple example of how to use the iddnsresolver
> object to get the mx records (priority and host) for a given domain.

Simply assign the Host property to point to the DNS server that you want to
use, add qtMX to the QueryRecords property, pass the desired domain to the
Resolve() method, and then loop through the QueryResults collection looking
for TMXRecord instances.  What is so complicated about that?

    IdDNSResolver1.QueryRecords := [qtMX];    // or assign in the Object
Inspector
    IdDNSResolver1.Host := 'dns.someserver.com';    // or assign in the
Object Inspector

    IdDNSResolver1.Resolve('somedomain');

    for I = 0 to IdDNSResolver1.QueryResult.Count-1 do
    begin
        if IdDNSResolver1.QueryResult[I] is TMXRecord then
        begin
            with IdDNSResolver1.QueryResult[I] as TMXRecord do
            begin
                ShowMessage('Host: ' + ExchangeServer + ', Priority: ' +
IntToStr(Preference));
            end;
        end;
    end;

Gambit

Replies

None

In response to

iddnsresolver demo/examples?? posted by Anthony on Thu, 30 Oct 2003