procedure TForm1.Button1Click(Sender: TObject);
var
s, QName, cs: string;
sl: TStringList;
i: integer;
MXRecord: TMXRecord;
begin
s := 'hfghfghfg@sohu.com';
QName := TrimRight(copy(s, Pos('@', s) + 1, Length(s)));
sl := TStringList.Create;
try
DnsREsolver.QueryRecords := [qtMX];
DnsREsolver.host := '192.168.1.1';
DnsREsolver.Resolve(QName);
sl.Add('Answers Count=' + IntToStr(DnsREsolver.QueryResult.Count));
for i := 0 to DnsREsolver.QueryResult.Count - 1 do
begin
//TMXRecord
cs := DnsREsolver.QueryResult.Items.ClassName;
if not SameText(cs, 'TMXRecord') then
Continue;
MXRecord := TMXRecord(DnsREsolver.QueryResult.Items);
sl.add(MXRecord.ExchangeServer);
end;
finally
end;
ShowMessage(sl.Text);
FreeAndNil(sl);
end;
???