ImapLowLevelDataSent Event
Occurs when data is sent to the connected socket.

Namespace: MailBee.ImapMail
Assembly: MailBee.NET (in MailBee.NET.dll) Version: 11.2.0 build 590 for .NET 4.5
public event DataTransferEventHandler LowLevelDataSent


Type: MailBeeDataTransferEventHandler

If the transmission channel is encrypted, this event will be raised each time an encrypted chunk of data is successfully sent. Thus, this event can be used to record the data which is actually sent to the network.

The typical use of this property is to calculate the network traffic produced during the IMAP4 session. SSL encryption increases the length of the transmitted data blocks, thus it's more accurate to calculate traffic by counting the length of data actually transmitted over the network.

If the transmission channel is not encrypted or otherwise scrambled, this property is equivalent to DataSent.

This sample calculates all outgoing traffic to the server during the IMAP4 session, and prints the result into console.
using System;
using MailBee;
using MailBee.ImapMail;
using MailBee.Mime;

class Sample
    // Total bytes sent counter.
    private static int _totalBytes = 0;

    // LowLevelDataSent event handler.
    private static void OnLowLevelDataSent(object sender, DataTransferEventArgs e)
        // Increment the counter.
        _totalBytes += e.Data.Length;

    // The actual code.
    static void Main(string[] args)
        Imap imp = new Imap();

        // Subscribe to the LowLevelDataSent event.
        imp.LowLevelDataSent += new DataTransferEventHandler(OnLowLevelDataSent);

        // Do something which would produce some network traffic.
        imp.Login("jdoe", "secret");
        MailMessageCollection msgs =
            imp.DownloadMessageHeaders(Imap.AllMessages, false);

        // Print the total number of bytes previously sent to the server.
        Console.WriteLine(_totalBytes + " bytes sent in all");
See Also