Sample code for 30+ languages & platforms
PureBasic

IMAP NOOP Command

Demonstrates how to send an IMAP NOOP command using SendRawCommand.

Chilkat PureBasic Downloads

PureBasic
IncludeFile "CkImap.pb"

Procedure ChilkatExample()

    success.i = 0

    ; This example assumes the Chilkat API to have been previously unlocked.
    ; See Global Unlock Sample for sample code.

    imap.i = CkImap::ckCreate()
    If imap.i = 0
        Debug "Failed to create object."
        ProcedureReturn
    EndIf

    ; Connect to an IMAP server.
    ; Use TLS
    CkImap::setCkSsl(imap, 1)
    CkImap::setCkPort(imap, 993)
    success = CkImap::ckConnect(imap,"imap.example.com")
    If success <> 1
        Debug CkImap::ckLastErrorText(imap)
        CkImap::ckDispose(imap)
        ProcedureReturn
    EndIf

    ; Login
    success = CkImap::ckLogin(imap,"****","****")
    If success <> 1
        Debug CkImap::ckLastErrorText(imap)
        CkImap::ckDispose(imap)
        ProcedureReturn
    EndIf

    ; Send a NOOP command
    resp.s = CkImap::ckSendRawCommand(imap,"NOOP")
    Debug resp

    ; Disconnect from the IMAP server.
    success = CkImap::ckDisconnect(imap)


    CkImap::ckDispose(imap)


    ProcedureReturn
EndProcedure