Occurs when data is sent to the IMAP4 server.
The event handler receives an argument of type DataTransferEventArgs containing data related to this event. The following DataTransferEventArgs properties provide information specific to this event.
| Property | Description |
|---|---|
| Data | Gets a reference to the data block (chunk) sent or received. |
| Protocol | Gets application-level protocol of the current connection. |
| RemoteEndPoint | Gets a reference to the end point of the server host. |
| RemoteHostName | Gets the host name of the server. |
| State | Gets a reference to the object which was supplied by the developer in state parameter of asynchronous methods of the mailer components. |
Unlike LowLevelDataSent event, occurrence of this event indicates sending IMAP4-related data only. For instance, if the transmission channel is SSL-encrypted, LowLevelDataSent event indicates sending of any portion of encrypted data, while DataSent will be raised later to indicate the entire request (which was previously sent as one or several encrypted data chunks) has been sent. If the transmission channel is not encrypted or otherwise scrambled, DataSent and LowLevelDataSent are equivalent.
This sample prints all the data sent to the server during IMAP4 session into console.
[C#] using System; using MailBee; using MailBee.ImapMail; class Sample { // DataSent event handler. private static void OnDataSent(object sender, DataTransferEventArgs e) { Console.WriteLine("[" + System.Text.Encoding.Default.GetString(e.Data) + "]"); } // The actual code. static void Main(string[] args) { Imap imp = new Imap(); // Subscribe to the DataSent event. imp.DataSent += new DataTransferEventHandler(OnDataSent); // Do something which would produce some network traffic. imp.Connect("imap.host.com"); imp.Login("jdoe", "secret"); imp.Disconnect(); } }
[Visual Basic] Imports System Imports MailBee Imports MailBee.ImapMail Module Sample ' DataSent event handler. Private Sub OnDataSent(ByVal sender As Object, ByVal e As DataTransferEventArgs) Console.WriteLine("[" & System.Text.Encoding.Default.GetString(e.Data) & "]") End Sub ' The actual code. Sub Main(ByVal args As String()) Dim imp As New Imap ' Subscribe to the DataSent event. AddHandler imp.DataSent, AddressOf OnDataSent ' Do something which would produce some network traffic. imp.Connect("imap.host.com") imp.Login("jdoe", "secret") imp.Disconnect() End Sub End Module
Imap Class | MailBee.ImapMail Namespace | LowLevelDataSent