wodSmtpServer ActiveX Control - QueryDNS Method
      
 

Description

Sends query to DNS server for the address.


Return Type

None  


Syntax

object.QueryDNS Type, Address, Timeout, [ID]



The QueryDNS Method syntax has these parts:

Part Description
object An expression evaluating to an object of type wodSmtpServer.
Type Required. A DnsQueryTypes enumeration, as described in settings. Determine type of query to be sent (MX, A, ...).
Address Required. A String value. Address or domain that needs to be resolved.
Timeout Required. An Integer value. Timeout to wait for the answer, in seconds.
ID Optional. A Variant value. Any Variant value that will be returned back in DNSResponse event. You can consider this as a 'cookie' value.

Settings

The settings for Type are:

Constant Value Description
 QueryMX 0 Sends MX query to DNS server.
 QueryA 1 Sends A query to DNS server.
 QueryPTR 2 Sends PTR query to DNS server.
 QueryTXT 3 Sends TXT query to DNS server.

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 connect to ORDB database (open relay database) and send queries to them to determine if incoming mail is possible SPAM or not.

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 wodSmtpServer. For example, DNS server may reply that it's not authoritative for your query and will point you to another DNS server. wodSmtpServer will automatically resend the request - until response is received or timeout expires.

QueryDNS can be used anytime and any number of times.

QueryTXT type can be used, for example, to obtain SPF (anti spam) records from sender server. For example, you can try to retrieve it for Google:

wodSmtpServer1.QueryDNS QueryTXT, "google.com", 30

to get response like this: v=spf1 ptr ?all.google.com