opcode new media services

 

MxLookup

Performs a DNS lookup on a domain to find the mail exchanger (MX) record. This can be used as part of an email system, or to validate email domains. E.g. if a user enters someone@hotmail.com, use the component to get the MX record for hotmail.com. If no MX records are returned, it's not a valid e-mail address.

Click here to try it out!

 Download
 Size: 144kb


License

This component is free for non-commercial use. However if you want to use it in commercial (retail or in-house) software you must purchase a commercial version from here.

By downloading this software you indicate acceptance of these terms and assume all liability relating to it's use.

Installation

Register the DLL as normal (using regsvr32), it's then ready for use.

Usage

There are only a couple of objects and methods in the component, click here for details. The core object is MxLookup. This is used to a perform query, which return a collection of host information. The easiest way to demonstrate is with an example (taken from a test VBS file):
Dim mx
Set mx = createobject("MxLookup.MxLookup")
mx.NameServer = "158.43.128.1"

Dim hosts
Set hosts = mx.FindHosts("hotmail.com")

MsgBox hosts.Count & " hosts found"

Dim host
For Each host In hosts
	MsgBox host.preference & " " & _
		host.Name & " " & host.IPAddress
Next
Set mx = Nothing

Source code

If you'd like the source code, drop me a line at ianv@opcode.co.uk.

Version History

v1First publicly released version
v1.2Added logging (to file %SYSTEM%\mxlookup.log), extra error handling and retries (makes 10 attempts if no response recvd from nameserver)

Play BattleFingers a fun new iPhone/iPod Touch game!
Free Downloads