Sample code for 30+ languages & platforms
Xojo Plugin

Send a Raw IMAP Command

See more IMAP Examples

Demonstrates the Chilkat Imap.SendRawCommand method, which sends raw IMAP command text and returns the raw server response. Pass the command itself (such as NOOP) without an IMAP tag — Chilkat adds the tag automatically. This example sends a raw NOOP.

Background: Every IMAP command a client sends is prefixed with a short unique tag (like a001) so the client can match the tagged completion response to the command it issued. SendRawCommand handles that tagging for you and returns the server's reply verbatim — an escape hatch for issuing a command Chilkat doesn't wrap directly, or a server-specific extension, without leaving the established authenticated session.

Chilkat Xojo Plugin Downloads

Xojo Plugin
Dim success As Boolean
success = False

//  Demonstrates the Imap.SendRawCommand method, which sends raw IMAP command text and returns
//  the raw server response.  Pass the command itself (such as NOOP) without an IMAP tag --
//  Chilkat adds the tag automatically.

Dim imap As New Chilkat.Imap

imap.Ssl = True
imap.Port = 993

success = imap.Connect("imap.example.com")
If (success = False) Then
    System.DebugLog(imap.LastErrorText)
    Return
End If

success = imap.Login("user@example.com","myPassword")
If (success = False) Then
    System.DebugLog(imap.LastErrorText)
    Return
End If

//  Send a raw IMAP command and read the raw response.
Dim response As String
response = imap.SendRawCommand("NOOP")
If (imap.LastMethodSuccess = False) Then
    System.DebugLog(imap.LastErrorText)
    Return
End If

System.DebugLog(response)

success = imap.Disconnect()
If (success = False) Then
    System.DebugLog(imap.LastErrorText)
    Return
End If