Sample
code for ASP and CF is provided with the component
Example (ASP):
<% set Obj = Server.CreateObject("AdvMX.MX")
%>
Example (ColdFusion):
<CFOBJECT
Class="AdvMX.MX" Action="Create" Name="Obj">
AdvMX Properties
Property |
Description |
DNSServer
|
This
property is used to set your DNS server which will be
used to perform all operations. This property is optional
to set, if you don't set any DNS server then system's
default DNS server is used.
Example (ASP):
<% Obj.DNSServer
= "128.242.115.166" %>
Example (ColdFusion):
<CFSET Obj.DNSServer = "128.242.115.166">
|
DomainName |
This
property is used to set domain name for which you want
to find the MX records.
Example (ASP):
<% Obj.DomainName
= "aspfusion.net" %>
Example (ColdFusion):
<CFSET Obj.DomainName = "aspfusion.net">
|
ErrorReason |
Reports
any error that occurred during the request.
Example (ASP):
<% if Obj.IsError = 1 then
Response.Write
Obj.ErrorReason
else
No Error
Occurred
end if %>
Example (ColdFusion):
<CFIF #Obj.IsError# EQ 1>
<CFOUTPUT>#Obj.ErrorReason#</CFOUTPUT>
<CFELSE>
<CFOUTPUT>No
Error Occurred</CFOUTPUT>
</CFIF>
|
IsError
|
Returns
1 if any error occurred during the request otherwise
0.
Example (ASP):
<% if Obj.IsError = 1 then
Response.Write
Obj.ErrorReason
else
No Error
Occurred
end if %>
Example (ColdFusion):
<CFIF #Obj.IsError# EQ 1>
<CFOUTPUT>#Obj.ErrorReason#</CFOUTPUT>
<CFELSE>
<CFOUTPUT>No
Error Occurred</CFOUTPUT>
</CFIF>
|
MXRecords
|
This
property is used to get total number of MX records for
the specified domain name.
Example (ASP):
<% Obj.DomainName
= "aspfusion.net"
Obj.DNSServer =
"128.242.115.166"
Response.Write Obj.MXRecords
%>
Example (ColdFusion):
<CFSET Obj.DomainName = "aspfusion.net">
<CFSET Obj.DNSServer = "128.242.115.166">
<CFOUTPUT>#Obj.MXRecords#</CFOUTPUT>
|
Timeout |
This
property is used to set request timeout value. If
not specified then default timeout value 60
is used.
Example (ASP):
<% Obj.Timeout
= 5 %>
Example (ColdFusion):
<CFSET Obj.Timeout = 5>
|
AdvMX Methods
Method |
Parameter |
Return Value |
Description |
DNSLookup
|
1.
Domain Name |
String
|
DNSLookup
does a normal DNS lookup on given domain name. The
return value, if successful, is the IP address for
the domain name.
Example (ASP):
<% Response.Write
Obj.DNSLookup("aspfusion.net
") %>
Example (ColdFusion):
<CFOUTPUT>#Obj.DNSLookup("aspfusion.net")#</CFOUTPUT>
|
ReverseDNSLookup |
1.
IP Address |
String
|
ReverseDNSLookup does a reverse DNS lookup on given
IP address. The return value, if successful, is the
domain name for the IP address.
Example (ASP):
<% Response.Write
Obj.ReverseDNSLookup("128.242.115.166") %>
Example (ColdFusion):
<CFOUTPUT>#Obj.ReverseDNSLookup("128.242.115.166")#</CFOUTPUT>
|
GetMXRecord |
None
|
Array
of objects |
Return
listing of all MX records along with their
preferences for given domain name.
Example (ASP):
<% Obj.DomainName
= "aspfusion.net"
Obj.DNSServer =
"128.242.115.166"
set Result = Obj.GetMXRecord()
for each Member in
Result
Response.Write
Member.MX
Response.Write
Member.Preference
next
set Result = nothing %>
Example (ColdFusion):
<CFSET
Obj.DomainName = "aspfusion.net">
<CFSET Obj.DNSServer = "128.242.115.166">
<CFSET Result = Obj.GetMXRecord()>
<CFLOOP Collection="#Result#" Item="Member">
<CFOUTPUT>
#Member.MX#
#Member.Preference#
</CFOUTPUT>
</CFLOOP>
WHERE in GetMXRecord collection
MX |
name of mail exchanger (MX) |
Preference |
the
preference or priority of MX |
|
VerifySMTP |
1.
SMTP Server |
True/False |
VerifySMTP verifies the specified SMTP server.
The return value, if successful, is True otherwise
False.
Example (ASP):
<% if Obj.VerifySMTP("mail.advcomm.net ") = 1 then
Response.Write "SMTP
server has been verified"
else
Response.Write "Invalid
SMTP server"
end if %>
Example (ColdFusion):
<CFIF #Obj.VerifySMTP("mail.advcomm.net")# EQ 1>
<CFOUTPUT>SMTP
server has been verified</CFOUTPUT>
<CFELSE>
<CFOUTPUT>Invalid
SMTP server</CFOUTPUT>
</CFIF>
|
|