Occurs when the IMAP4 server name is successfully resolved into IP address(es).
The event handler receives an argument of type HostResolvedEventArgs containing data related to this event. The following HostResolvedEventArgs properties provide information specific to this event.
| Property | Description |
|---|---|
| RemoteHost | Gets a reference to the resolved host data. |
| State | Gets a reference to the object which was supplied by the developer in state parameter of asynchronous methods of the mailer components. |
If the IMAP4 server name (serverName parameter of Connect method) was already specified as an IP address, this event is still raised.
Note No checking if performed on whether the resolved IP address points to the live host.
This sample connects to the IMAP4 server host and prints all the IP addresses of this host into console. Most hosts, however, have only one IP address assigned.
[C#] using System; using MailBee; using MailBee.ImapMail; class Sample { // HostResolved event handler. private static void OnHostResolved(object sender, HostResolvedEventArgs e) { foreach (System.Net.IPAddress ip in e.RemoteHost.AddressList) { Console.WriteLine(ip.ToString()); } } // The actual code. static void Main(string[] args) { Imap imp = new Imap(); // Subscribe to the HostResolved event. imp.HostResolved += new HostResolvedEventHandler(OnHostResolved); imp.Connect("imap.company.com"); imp.Disconnect(); } }
[Visual Basic] Imports System Imports MailBee Imports MailBee.ImapMail Module Sample ' HostResolved event handler. Private Sub OnHostResolved(ByVal sender As Object, ByVal e As HostResolvedEventArgs) For Each ip As System.Net.IPAddress In e.RemoteHost.AddressList Console.WriteLine(ip.ToString()) Next End Sub ' The actual code. Sub Main(ByVal args As String()) Dim imp As New Imap ' Subscribe to the HostResolved event. AddHandler imp.HostResolved, AddressOf OnHostResolved imp.Connect("imap.company.com") imp.Disconnect() End Sub End Module
Imap Class | MailBee.ImapMail Namespace | SocketConnected | Connected