winexec
asked on
MX servers
Good day,
I want to find the MX servers for specific domains. By example, for hushmail.com the server is smtp.hushmail.com, for hotmail.com is mx1.hotmail.com etc.
I searched on the web and I found I have to use the function GetNetworkParams (on 2000, XP). Does anyone know an example?
Thank you,
W.
I want to find the MX servers for specific domains. By example, for hushmail.com the server is smtp.hushmail.com, for hotmail.com is mx1.hotmail.com etc.
I searched on the web and I found I have to use the function GetNetworkParams (on 2000, XP). Does anyone know an example?
Thank you,
W.
or... you can make with Indy component id IdDNSResolver, as resolved in the question:
https://www.experts-exchange.com/questions/20903774/IndyClients-Delphi-7.html?query=IdDNSResolver&topics=85
https://www.experts-exchange.com/questions/20903774/IndyClients-Delphi-7.html?query=IdDNSResolver&topics=85
ASKER
Thanks RadikalQ3,
I looked at the jedi example, but I don't know how to use it for my purpose.
The example below (found on the link you posted) does nothing, the memo remain clean. Besides, how can I use it to find the MX for hushmail.com?
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, iphlpapi, iptypes, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Memo1: TMemo;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender : TObject);
var
info: PFixedInfo;
Buflen: cardinal;
begin
Buflen := 1024;
GetMem(info, BufLen);
try
GetNetworkParams(info, BufLen);
memo1.Lines.Add(info.DnsSe rverList.I pAddress.S );
finally
FreeMem(info);
end;
end;
end.
Thankx, W.
P.S. I prefer not to use Indy, I don't even have the components installed.
I looked at the jedi example, but I don't know how to use it for my purpose.
The example below (found on the link you posted) does nothing, the memo remain clean. Besides, how can I use it to find the MX for hushmail.com?
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, iphlpapi, iptypes, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Memo1: TMemo;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender
var
info: PFixedInfo;
Buflen: cardinal;
begin
Buflen := 1024;
GetMem(info, BufLen);
try
GetNetworkParams(info, BufLen);
memo1.Lines.Add(info.DnsSe
finally
FreeMem(info);
end;
end;
end.
Thankx, W.
P.S. I prefer not to use Indy, I don't even have the components installed.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
OK, i downloaded Synapse, but what exactly should I write in the place of "dns host name or ip address"
Thankx,
W.
Thankx,
W.
ip or name of dns server(the computer that dns service running on it)
Commonly then domain name is dns server.
for example in our lan:
dns server is: 172.20.20.21
domain is: test.com
and when i run the my code
return "mail.test.com" in memo1.lines
-------------------------- ---------- ---------
Commonly then domain name is dns server.
for example in our lan:
dns server is: 172.20.20.21
domain is: test.com
and when i run the my code
return "mail.test.com" in memo1.lines
--------------------------
ex.:
GetMailServers('yahoo.com' ,'yahoo.co m',Memo1.L ines);
GetMailServers('yahoo.com'
ASKER
Thanks, but it doesn't work :( The memo remains empty.
Are you sure it's working for you?
W.
Are you sure it's working for you?
W.
yes its work.
see the result of command "ipconfig /all"
and set the dns host server to one of server listed on dns servers
see the result of command "ipconfig /all"
and set the dns host server to one of server listed on dns servers
are you on behind of proxy and the doamin you need the mx record of it, out side of your lan?
are you computer has valid ip over internet?
ASKER
i am in a VPN, i tried to use the DNS found with ipconfig and didn't work, afterwards I connected with diaup and tried again, it didn't work :(
ASKER
i forgot to say: i tried to find the MX for yahoo.com
i am not test 'yahoo.com' only for example i set it .
i am test my code on our LAN.
i am test my code on our LAN.
GetMailServers('ns1.yahoo. com','yaho o.com',Mem o1.Lines);
works for me.
replace ns1.yahoo.com with your isp dns.
works for me.
replace ns1.yahoo.com with your isp dns.
No comment has been added to this question in more than 21 days, so it is now classified as abandoned.
I will leave the following recommendation for this question in the Cleanup topic area:
Accept AFZDeveloper's comment as answer.
Any objections should be posted here in the next 4 days. After that time, the question will be closed.
Jacco
EE Cleanup Volunteer
I will leave the following recommendation for this question in the Cleanup topic area:
Accept AFZDeveloper's comment as answer.
Any objections should be posted here in the next 4 days. After that time, the question will be closed.
Jacco
EE Cleanup Volunteer
You have an example of use of this function via the jedi project iphelper api wrapper in:
https://www.experts-exchange.com/questions/20771226/Obtain-DNS-Server-addresses-auomatically.html