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




Represents a single line response from an IMAP server.

Object Model

ImapResponse Class

Syntax

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

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

The ImapResponse class represents a single line response from an IMAP server. A response from an IMAP server may be received as a reply to a command, or may be received unprovoked. Individual fields of the response are parsed into properties of the ImapResponse class. Whenever a response is received from the server, the data is parsed into an ImapResponse object and the Imap.LineReceived event is raised to allow the user access to the information. This built-in response parsing makes Imap.LineReceived superior to Imap.Trace when the user is interested in the contents of the response.

For example, if the following line was received from the IMAP server,

* OK [UIDVALIDITY 1032904889] UIDs valid

the properties of this object would be as follows:

Property Value
ImapResponse.Code ImapCode.UidValidity
ImapResponse.CodeValue "1032904889"
ImapResponse.Explanation "UIDs valid"
ImapResponse.Operation ""
ImapResponse.Status ImapStatus.Ok
ImapResponse.Tag "*"
ImapResponse.Value ""

Inheritance Hierarchy

System.Object
   Dart.PowerTCP.Mail.ImapResponse

Requirements

Target Platforms: Microsoft .NET Framework 2.0

See Also

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