/// <summary> /// Is called when email domain target servers resolve operation has completed. /// </summary> /// <param name="to">RCPT TO: address.</param> /// <param name="op">Asynchronous operation.</param> /// <exception cref="ArgumentNullException">Is raised when <b>to</b> or <b>op</b> is null reference.</exception> private void EmailHostsResolveCompleted(string to, Dns_Client.GetEmailHostsAsyncOP op) { if (to == null) { throw new ArgumentNullException("to"); } if (op == null) { throw new ArgumentNullException("op"); } if (op.Error != null) { LogText("Failed to resolve email domain for email address '" + to + "' with error: " + op.Error.Message + "."); Dispose(op.Error); } else { StringBuilder buf = new StringBuilder(); foreach (HostEntry host in op.Hosts) { foreach (IPAddress ip in host.Addresses) { m_pTargets.Add(new Relay_Target(host.HostName, new IPEndPoint(ip, 25))); } buf.Append(host.HostName + " "); } LogText("Resolved to following email hosts: (" + buf.ToString().TrimEnd() + ")."); BeginConnect(); } op.Dispose(); }