PowerTCP Mail for .NET
ImapResponseEventArgs Class
Members  Example  See Also  Send comments on this topic.
Dart.PowerTCP.Mail Namespace : ImapResponseEventArgs Class




Provides data for the Imap events: Imap.Alert, Imap.EndClear, Imap.EndCopy, Imap.EndExamine, Imap.EndInvoke, Imap.EndLogin, Imap.EndLogout, Imap.EndMailboxRemove, Imap.EndNoop, Imap.EndPurge, Imap.EndRefresh, Imap.EndSet, Imap.EndSubscribe, Imap.EndSubscribe, Imap.LineReceived, Imap.Update.

Object Model

ImapResponseEventArgs ClassImapResponse ClassImapResponse Class

Syntax

Visual Basic (Declaration) 
Public Class ImapResponseEventArgs 
   Inherits EndEventArgs
Visual Basic (Usage)Copy Code
Dim instance As ImapResponseEventArgs
C# 
public class ImapResponseEventArgs : EndEventArgs 
Managed Extensions for C++ 
public __gc class ImapResponseEventArgs : public EndEventArgs 
C++/CLI 
public ref class ImapResponseEventArgs : public EndEventArgs 

Example

The following example demonstrates using the LineReceived event to detect Status responses.
Visual BasicCopy Code
Private Sub DoSomething()
   ' Log in. The Imap.LineReceived event will be raised when data is received
   Imap1.Login(Server, User, Pass)

   ' Send a NOOP
   Imap1.Noop()

   ' Log out
   Imap1.Logout()
End Sub

Private Sub Imap1_LineReceived(ByVal sender As Object, ByVal e As Dart.PowerTCP.Mail.ImapResponseEventArgs) Handles Imap1.LineReceived
   Dim Response As ImapResponse
   ' Iterate through all responses.
   For Each Response In e.Responses
      ' Check if it is a status response. 
      If Response.ResponseType = ImapResponseType.Status Then 
         Debug.WriteLine("The server has returned a status response")
         Debug.WriteLine("Status: " + Response.Status)
         Debug.WriteLine("Explanation: " + Response.Explanation)
      End If
   Next
End Sub
C#Copy Code
private void DoSomething()
{
   // Log in. The Imap.LineReceived event will be raised when data is received
   imap1.Login(Server, User, Pass);

   // Send a NOOP
   imap1.Noop();

   // Log out
   imap1.Logout();
}

private void imap1_LineReceived(object sender, Dart.PowerTCP.Mail.ImapResponseEventArgs e)
{
   // Iterate through all responses.
   foreach(ImapResponse response in e.Responses)
   {
      // Check if it is a status response.
      if(response.ResponseType == ImapResponseType.Status)
      {
         Debug.WriteLine("The server has returned a status response");
         Debug.WriteLine("Status: " + response.Status);
         Debug.WriteLine("Explanation: " + response.Explanation);
      }
   }
}

Remarks

This class provides event data for any event that handles a response from the IMAP server. This event could be a reporting-type event (such as the Imap.LineReceived event, which is raised on each line received) or a process completed event (such as any of the EndXXX events listed above, which are raised upon completion of the associated BeginXXX method).

If multiple responses are expected, these responses will be part of the ImapResponseEventArgs.Responses property. ImapResponseEventArgs.Response will reflect the first response. For this reason, ImapResponseEventArgs.Response will always equal Responses[0].

Inheritance Hierarchy

System.Object
   System.EventArgs
      Dart.PowerTCP.Mail.EndEventArgs
         Dart.PowerTCP.Mail.ImapResponseEventArgs

Requirements

Target Platforms: Microsoft .NET Framework 2.0

See Also

Documentation Version 3.2
© 2010 Dart Communications. All Rights Reserved.