0 votes
by (430 points)

hello,
after calling Smtp.ResolveDomainMx, is there a way to distinguish between:
- a non existing domain,
- an existing domain for which a timeout occurred during DNS lookup in the upstream DNS server ? assuming a shorter timeout for the upstream DNS server than for the ResolveDomainMx call.

thanks.

Applies to: Rebex Secure Mail

1 Answer

0 votes
by (73.6k points)

If a domain's MX record doesn't exist, you will receive empty array as return value of the Smtp.ResolveDomainMx method.

If a timeout occurs, the SmtpException with SmtpExceptionStatus.Timeout is thrown.

For other known reasons the SmtpException with appropriate SmtpExceptionStatus is thrown (e.g. unsupported record type).

For other unknown reasons the original exception received from the system is thrown.

by (430 points)
edited by
Hello Lukas,
thanks for the reply.
that's what I thought, but unfortunately this is not my experience (Rebex Securemail build 6198).
To check this, I set up a DNS server on a windows 2012R2 machine, blocked any external DNS requests by a firewall. in this situation, when using the DNS server, nslookup always reports a timeout.
when calling Smtp.ResolveDomainMx for the first time (after a ipconfig /flushdns), a SmtpException with message "socket error 11002 occurred",   status "DomainResolutionfailure". From the 2nd call on, sometimes I just get back an empty array, no SmtpException gets thrown, sometimes another SmtpException with status DomainResolutionFailure.
The SmtpResolveDomainMx call always takes 20sec, the timeout parameter passed to the call.
by (73.6k points)
Can you please send us network capture from Wireshark? You can do it like this:
Download Wireshark from https://www.wireshark.org
Install and Run under Admin.
Go to Menu->Capture->Options in filter type "port 53" without quotes and hit Start button.
Run Smtp.ResolveDomainMx (as you run it before).
Go to Menu->Capture->Stop
Go to Menu->File->Save
Send us produced capture to support@rebex.net
...