DataFlex
DataFlex
Get the IMAP Server Capabilities
See more IMAP Examples
Demonstrates the Chilkat Imap.Capability method, which sends the IMAP CAPABILITY command and returns the server's raw capability response. This example connects and prints the capability list. Use HasCapability to test for a specific one.
Background: Not all IMAP servers support the same features. The
CAPABILITY response is the server's advertised menu — a space-separated list of extensions such as IDLE (push notifications of new mail), MOVE, UIDPLUS, QUOTA, and the supported AUTH= mechanisms. A well-behaved client checks capabilities before relying on an optional feature, falling back gracefully when it is absent.Chilkat DataFlex Downloads
Use ChilkatAx-win32.pkg
Procedure Test
Boolean iSuccess
Handle hoImap
String sCapabilities
String sTemp1
Boolean bTemp1
Move False To iSuccess
// Demonstrates the Imap.Capability method, which sends the IMAP CAPABILITY command and
// returns the server's raw capability response.
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
// Ask the server for its capability list.
Get ComCapability Of hoImap To sCapabilities
Get ComLastMethodSuccess Of hoImap To bTemp1
If (bTemp1 = False) Begin
Get ComLastErrorText Of hoImap To sTemp1
Showln sTemp1
Procedure_Return
End
Showln "Server capabilities: " sCapabilities
// Sample output:
//
// Server capabilities: * CAPABILITY IMAP4rev1 LOGIN-REFERRALS ID ENABLE IDLE SASL-IR LITERAL+ AUTH=PLAIN AUTH=LOGIN
// aaab OK Pre-login capabilities listed, post-login capabilities have more.
Get ComDisconnect Of hoImap To iSuccess
If (iSuccess = False) Begin
Get ComLastErrorText Of hoImap To sTemp1
Showln sTemp1
Procedure_Return
End
End_Procedure