DataFlex
DataFlex
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 DataFlex Downloads
Use ChilkatAx-win32.pkg
Procedure Test
Boolean iSuccess
Handle hoImap
String sResponse
String sTemp1
Boolean bTemp1
Move False To iSuccess
// 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.
Get Create (RefClass(cComChilkatImap)) To hoImap
If (Not(IsComObjectCreated(hoImap))) Begin
Send CreateComObject of hoImap
End
Set ComSsl Of hoImap To True
Set ComPort Of hoImap To 993
Get ComConnect Of hoImap "imap.example.com" To iSuccess
If (iSuccess = False) Begin
Get ComLastErrorText Of hoImap To sTemp1
Showln sTemp1
Procedure_Return
End
Get ComLogin Of hoImap "user@example.com" "myPassword" To iSuccess
If (iSuccess = False) Begin
Get ComLastErrorText Of hoImap To sTemp1
Showln sTemp1
Procedure_Return
End
// Send a raw IMAP command and read the raw response.
Get ComSendRawCommand Of hoImap "NOOP" To sResponse
Get ComLastMethodSuccess Of hoImap To bTemp1
If (bTemp1 = False) Begin
Get ComLastErrorText Of hoImap To sTemp1
Showln sTemp1
Procedure_Return
End
Showln sResponse
Get ComDisconnect Of hoImap To iSuccess
If (iSuccess = False) Begin
Get ComLastErrorText Of hoImap To sTemp1
Showln sTemp1
Procedure_Return
End
End_Procedure