#131292 - 2004-12-15 02:32 AM
MX Record lookup help
|
NTDOC
Administrator
Registered: 2000-07-28
Posts: 11624
Loc: CA
|
Does anyone know of a FREE tool or method to perform an MX record lookup from within KiXtart to supply an address to an application?
Microsoft's NSLOOKUP allows you to set a filter to do this, but not in a non-interactive mode.
How to obtain Internet Mail Exchanger records with the Nslookup.exe Utility
http://support.microsoft.com/default.aspx?scid=kb;EN-US;203204
Example:
NSLOOKUP
[now puts you into an interactive mode]
set q=mx [now only queries mx records]
mymailserver.mycompany.com
Would come back with something similar to this:
Server: mydnsserver.mycompany.com
Address: 122.120.100.1
authoritative answer:
mymailserver.mycompany.com MX preference = 10, mail exchanger = server1.eastcoast.mycompany.com
mymailserver.mycompany.com MX preference = 0, mail exchanger = server1.westcoast.mycompany.com
mymailserver.mycompany.com MX preference = 0, mail exchanger = server2.westcoast.mycompany.com
What I'm attempting to do is use BLAT to send e-mail, but I want to have KiXtart check and verify first that the server is up and if not then check the next server in line
BLAT does not appear to natively support an MX record lookup so I want to attempt to have KiX support it for BLAT.
I've found tools to do it, but would prefer a free method or tool to do so. In my case I already know all the real names, so I could manually code it in KiXtart, but I would rather automate it so that in case a server is changed I don't have to modify my code, which is the purpose of having an MX record in the first place.
Email Toolbox MX Record
http://www.arclab.com/products/emailtoolbox/mxrecord.html
HexValidEmail
http://www.hexillion.com/hg/asp-email-verification-component/
I'm sure Howard could supply an EXE using Perl to do this. Too bad Microsoft does not allow this in a non-interactive mode
Edited by NTDOC (2004-12-15 02:39 AM)
|
Top
|
|
|
|
#131294 - 2004-12-15 05:56 AM
Re: MX Record lookup help
|
NTDOC
Administrator
Registered: 2000-07-28
Posts: 11624
Loc: CA
|
Thanks Al - consider your DOUBLE CTRL-ALT-DEL paid off
I thought I had tried that already, but was on someone else's VMware session and it did not appear to work.
I just tried it at home and it seems to work. Will try it again at work tomorrow on my own system.
Cheers
|
Top
|
|
|
|
#131299 - 2004-12-16 08:16 AM
Re: MX Record lookup help
|
Allen
KiX Supporter
Registered: 2003-04-19
Posts: 4549
Loc: USA
|
Quote:
you're my internet hero
aw shucks
|
Top
|
|
|
|
#131300 - 2004-12-16 10:29 AM
Re: MX Record lookup help
|
Richard H.
Administrator
Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
|
You can also use redirection.
For simple queries: Code:
echo ls sgb.co.uk | nslookup
For multi-line queries, write the lines to a file and redirect it in: Code:
nslookup < ns_lookup_commands.txt
|
Top
|
|
|
|
#131303 - 2004-12-16 01:21 PM
Re: MX Record lookup help
|
Howard Bullock
KiX Supporter
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
|
Top
|
|
|
|
#131306 - 2004-12-17 02:23 AM
Re: MX Record lookup help
|
NTDOC
Administrator
Registered: 2000-07-28
Posts: 11624
Loc: CA
|
Well not pretty and not a best practice but it works.
Al_Po wrote this little tid-bit up and we cleaned it up a little for presentation until such time as there is a better method.
Code:
If MailServerUp($Server)
? 'System is responding'
Else
? 'System did not respond'
EndIf
Function MailServerUp($mailserver)
Dim $output,$,$fh,$line,$path
$output='%temp%\output.txt'
If Exist($output)
Del $output
EndIf
Run '%comspec% /c telnet -f ' + $output + ' ' + $mailserver + ' 25'
Sleep 2
$=EndProc('telnet.exe')
Sleep 1
$fh=FreeFileHandle()
If Open($fh,$output)=0
$line=ReadLine($fh)
While @ERROR=0
If Left($line,3)=220
$MailServerUp=1
EndIf
$line=ReadLine($fh)
Loop
$=Close($fh)
EndIf
If Exist($output)
Del $output
EndIf
EndFunction
Function EndProc($proc, optional $strComputer)
DIM $Process
If $strComputer=''
$strComputer='.'
EndIf
For Each $Process In GetObject("winmgmts:{impersonationLevel=impersonate}!\\" + $strComputer +
"\root\cimv2").ExecQuery("Select * from Win32_Process where Name= " +'"'+$Proc+'"')
$Process=$Process.Terminate
Next
EndFunction
|
Top
|
|
|
|
#131307 - 2004-12-17 05:27 AM
Re: MX Record lookup help
|
Allen
KiX Supporter
Registered: 2003-04-19
Posts: 4549
Loc: USA
|
All I can say is, I warned DOC it wasn't going to be pretty.
|
Top
|
|
|
|
Moderator: Arend_, Allen, Jochen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 920 anonymous users online.
|
|
|