A few bugfixes for mails (serious performance impact!)

Apr 3, 2014 at 10:47 AM
Just a few bug fixes. Performance impact is very significant - here the speed of sending an e-mail went from >25s to <2s:
  1. ActiveUp.Net.Mail.Validator.GetMxRecords(...) -- add 'if (answer == null) { return null; } else { ... }' . It now generates a null reference exception which is caught in another GetMxRecords method. That one should also handle a null check properly.
  2. DNS resolves from DirectSend are incorrect. It does a ServerCollection.Add in the DirectSend method, which defaults to port 25 for DNS -- this must be port 53; otherwise you will get a timeout (making sending mails very, very, very slow)
  3. Listing name servers should be unique. DnsQuery.GetMachineDnsServers returns a list of all DNS servers, but if you have multiple NIC's, there is probably an overlap. Best to use a HashSet<string> and sort the list to ensure you try to connect to IPv4 addresses first.
  4. DnsQuery.QueryServer uses InterNetwork for the Socket connection. This should be dnsServer.AddressFamily to also support f.ex. IPv6.