Форум: "Сети";
Текущий архив: 2003.08.21;
Скачать: [xml.tar.bz2];
ВнизMX record look-up Найти похожие ветки
← →
Иван (2003-06-17 11:16) [0]Народ, если есть у кого реализованный MX look-up, поделитесь, плиз. Шибко приперло, в инете поискал, кроме ICS (by F.Piette) компонент нифига не нашел. Тянуть их с собой нехочется.
Спасибо.
← →
Andrey Klimov (2003-06-17 19:12) [1]Indy 9.0.13
function TfrmMain.GetMailServers: Boolean;
var
i,x : integer;
LDomainPart : String;
LMXRecord : TMXRecord;
begin
if not assigned(fmailServers) then fMailServers := TStringList.Create;
fmailServers.clear;
Result := true;
with IdDNSResolver do
begin
QueryResult.Clear;
QueryRecords := [qtMX];
//Msg("Setting up DNS query parameters");
Host := edtDNS.text; //Адрес твоего DNS сервера
ReceiveTimeout := StrToInt(edtTimeOut.text);
// Extract the domain part from recipient email address
LDomainPart := copy(edtRecipient.text,pos("@",edtRecipient.text)+1,length(edtRecipient.text)); // the domain name to resolve
try
//Msg("Resolving DNS");
Resolve(LDomainPart);
if QueryResult.Count > 0 then
begin
for i := 0 to QueryResult.Count - 1 do
begin
LMXRecord := TMXRecord(QueryResult.Items[i]);
fMailServers.Append(PadZero(IntToStr(LMXRecord.Preference)) + "=" + LMXRecord.ExchangeServer);
end;
// sort in order of priority and then remove extra data
fMailServers.Sorted := false;
for i := 0 to fMailServers.count - 1 do
begin
x := pos("=",fMailServers.Strings[i]);
if x > 0 then fMailServers.Strings[i] :=
copy(fMailServers.Strings[i],x+1,length(fMailServers.Strings[i]));
end;
fMailServers.Sorted := true;
fMailServers.Duplicates := dupIgnore;
Result := true;
end
else
begin
//Msg("No response from DNS server");
MessageDlg("There is no response from the DNS server !", mtInformation, [mbOK], 0);
Result := false;
end;
except
on E : Exception do
begin
//Msg("Error resolving domain");
( "Error resolving domain: " + e.message, mtInformation, [mbOK], 0) Indy 9.0.13
function TfrmMain.GetMailServers: Boolean;
var
i,x : integer;
LDomainPart : String;
LMXRecord : TMXRecord;
begin
if not assigned(fmailServers) then fMailServers := TStringList.Create;
fmailServers.clear;
Result := true;
with IdDNSResolver do
begin
QueryResult.Clear;
QueryRecords := [qtMX];
//Msg("Setting up DNS query parameters");
Host := edtDNS.text; //Адрес твоего DNS сервера
ReceiveTimeout := StrToInt(edtTimeOut.text);
// Extract the domain part from recipient email address
LDomainPart := copy(edtRecipient.text,pos("@",edtRecipient.text)+1,length(edtRecipient.text)); // the domain name to resolve
try
//Msg("Resolving DNS");
Resolve(LDomainPart);
if QueryResult.Count > 0 then
begin
for i := 0 to QueryResult.Count - 1 do
begin
LMXRecord := TMXRecord(QueryResult.Items[i]);
fMailServers.Append(PadZero(IntToStr(LMXRecord.Preference)) + "=" + LMXRecord.ExchangeServer);
end;
// sort in order of priority and then remove extra data
fMailServers.Sorted := false;
for i := 0 to fMailServers.count - 1 do
begin
x := pos("=",fMailServers.Strings[i]);
if x > 0 then fMailServers.Strings[i] :=
copy(fMailServers.Strings[i],x+1,length(fMailServers.Strings[i]));
end;
fMailServers.Sorted := true;
fMailServers.Duplicates := dupIgnore;
Result := true;
end
else
begin
//Msg("No response from DNS server");
MessageDlg("There is no response from the DNS server !", mtInformation, [mbOK], 0);
Result := false;
end;
except
on E : Exception do
begin
//Msg("Error resolving domain");
MessageDlg("Error resolving domain: " + e.message, mtInformation, [mbOK], 0);
Result := false;
end;
end;
end;
end;
Страницы: 1 вся ветка
Форум: "Сети";
Текущий архив: 2003.08.21;
Скачать: [xml.tar.bz2];
Память: 0.46 MB
Время: 0.008 c