ImapServerStatus Event
Occurs when the IMAP4 server reports mailbox or server status information to the client.

Namespace: MailBee.ImapMail
Assembly: MailBee.NET (in MailBee.NET.dll) Version: 12.4 build 677 for .NET 4.5
Syntax
public event ImapServerStatusEventHandler ServerStatus

Value

Type: MailBee.ImapMailImapServerStatusEventHandler
Remarks

The server sends the status response to the client when a command is completed or there is a state change of the server or the currently folder, etc.

MailBee raises this event when it receives any of the following responses from the server: OK, NO, BAD, PREAUTH, BYE, or FLAGS.

The real-world application should subscribe to this event and at least check IsAlert property value. If it's true, it means the server sent [ALERT] response along with the human-readable message, and the application must present the supplied HumanReadable text to the user. For instance, the server may tell clients it's about to shutdown in a short while.

Examples
This sample connects to the server, logs in the account, selects inbox, and receives envelopes of all messages. If the server sends [ALERT] response during this time, it's displayed to the user.
using System;
using MailBee;
using MailBee.ImapMail;

class Sample
{
    // ServerStatus event handler.
    private static void OnServerStatus(object sender,
        ImapServerStatusEventArgs e)
    {
        if (e.IsAlert)
        {
            Console.WriteLine("The server warns: " + e.HumanReadable);
        }
    }

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

        // Subscribe to ServerStatus event.
        imp.ServerStatus +=
            new ImapServerStatusEventHandler(OnServerStatus);

        // Connect to the server, login and select inbox.
        imp.Connect("mail.company.com");
        imp.Login("jdoe", "secret");
        imp.SelectFolder("INBOX");

        // Download envelopes of all message in the inbox.
        EnvelopeCollection envs = imp.DownloadEnvelopes(Imap.AllMessages, false);

        imp.Disconnect();
    }
}
See Also