如何得知aaa@123.com所对应的邮件服务器??也就是@123.com的MX记录对应主机!(100分)

  • 主题发起人 主题发起人 !雅龙
  • 开始时间 开始时间

!雅龙

Unregistered / Unconfirmed
GUEST, unregistred user!
通过DNS协议进行会话咨询?
 
使用INDY9控件
function GetMailServers(Dns : string): Boolean;
var
I : integer;
begin
FDNSResolver := TIdDNSResolver.Create(nil);
try
if not assigned(fmailServers) then
fMailServers := TStringList.Create;
fmailServers.clear;
Result := True;
with FDNSResolver do
begin
Host := DNS;
ReceiveTimeout := 6000;
QueryRecords := [qtMX];
QueryResult.Clear;
Active := True;
try
FRelayStatus := 5;
Resolve('123.com');
Active := False;
if QueryResult.Count > 0 then
begin
for i := 0 to QueryResult.Count - 1 do
begin
if QueryResult is TMxRecord then
fMailServers.Append(TMXRecord(QueryResult).ExchangeServer);
end;
Result := True;
end
else
Result := False;
except
on E: Exception do
Result := False;
end;
end;
finally
FreeAndNil(FDNSResolver);
end;
end;
 

Similar threads

S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
D
回复
0
查看
2K
DelphiTeacher的专栏
D
后退
顶部