Pop3MessageDataChunkReceived Event
Occurs on progress of downloading message source data from the server.

Namespace: MailBee.Pop3Mail
Assembly: MailBee.NET (in MailBee.NET.dll) Version: 12.4 build 677 for .NET 4.5
public event Pop3MessageDataChunkReceivedEventHandler MessageDataChunkReceived


Type: MailBee.Pop3MailPop3MessageDataChunkReceivedEventHandler

This event is a special case of DataReceived event. While DataReceived event occurs when any data is received, MessageDataChunkReceived event indicates message data is being received. In other words, MessageDataChunkReceived event is a filtered version of more general DataReceived event.

When both DataReceived and MessageDataChunkReceived events are used, DataReceived is raised first.

This sample completely downloads the last message in the inbox, and deletes it from the server. Both DataReceived and MessageDataChunkReceived events are handled, and the corresponding messages are printed into console when each of these events is raised. This sample demonstrates that DataReceived is raised more often than MessageDataChunkReceived.
using System;
using MailBee;
using MailBee.Pop3Mail;
using MailBee.Mime;

class Sample
    // DataReceived event handler.
    private static void OnDataReceived(object sender, DataTransferEventArgs e)
        Console.WriteLine(e.Data.Length + " bytes received");

    // MessageDataChunkReceived event handler.
    private static void OnMessageDataChunkReceived(object sender,
        Pop3MessageDataChunkReceivedEventArgs e)
        Console.WriteLine(e.BytesJustReceived + " bytes of the message #" + 
            e.MessageNumber + " received");

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

        // Subscribe to events.
        pop.DataReceived += new DataTransferEventHandler(OnDataReceived);
        pop.MessageDataChunkReceived +=
            new Pop3MessageDataChunkReceivedEventHandler(OnMessageDataChunkReceived);

        pop.Login("jdoe", "secret");

        // Completely download the last message in the inbox.
        MailMessage msg = pop.DownloadEntireMessage(pop.InboxMessageCount);

See Also