Back to product page

QueryDNS Method


Sends query to DNS server for the address.

Syntax

  • Basic
object.QueryDNS (Type, Address, Timeout, [ID])
The QueryDNS(object,Type,Address,Timeout,ID) syntax has these parts:
objectAn expression evaluating to an object of type wodSmtp
TypeRequired. A DnsQueryTypes enumeration, as described in settings. Determines type of request.
AddressRequired. A String value. Address or domain that needs to be resolved.
TimeoutRequired. An Integer value. Specifies timeout, in seconds.
IDOptional. A Variant value. Variant value that will be returned back in DNSResponse event.

Remarks

QueryDNS will send DNS request to DNS server specified in DNSHostname property. It can be used for various tasks related to hostnames and domains connecting to your SMTP server. For example, you can use it to determine MX or A records for given email, so you can fill Hostname property by yourself.

When QueryDNS is used, it will send request to the server. When response arrives from the server, DNSResponse event will be fired where you can read result of your query. If error occurs, DNSResponse event will contain Success argument that will tell you if your query was successful or not.

If server replies with answer that was not expected, recursive queries are automatically resent by wodSmtp. For example, DNS server may reply that it's not authoritative for your query and will point you to another DNS server. wodSmtp will automatically resend the request - until response is received or timeout expires.

QueryDNS can be used anytime and any number of times.

Platforms

Windows