Pop3MessageDataChunkReceived Event |
Namespace: MailBee.Pop3Mail
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.
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.Connect("mail.domain.com"); pop.Login("jdoe", "secret"); // Completely download the last message in the inbox. MailMessage msg = pop.DownloadEntireMessage(pop.InboxMessageCount); pop.Disconnect(); } }