PowerBuilder
PowerBuilder
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 PowerBuilder Downloads
integer li_rc
integer li_Success
oleobject loo_Imap
string ls_Capabilities
li_Success = 0
// Demonstrates the Imap.Capability method, which sends the IMAP CAPABILITY command and
// returns the server's raw capability response.
loo_Imap = create oleobject
li_rc = loo_Imap.ConnectToNewObject("Chilkat.Imap")
if li_rc < 0 then
destroy loo_Imap
MessageBox("Error","Connecting to COM object failed")
return
end if
loo_Imap.Ssl = 1
loo_Imap.Port = 993
li_Success = loo_Imap.Connect("imap.example.com")
if li_Success = 0 then
Write-Debug loo_Imap.LastErrorText
destroy loo_Imap
return
end if
// Ask the server for its capability list.
ls_Capabilities = loo_Imap.Capability()
if loo_Imap.LastMethodSuccess = 0 then
Write-Debug loo_Imap.LastErrorText
destroy loo_Imap
return
end if
Write-Debug "Server capabilities: " + ls_Capabilities
// 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.
li_Success = loo_Imap.Disconnect()
if li_Success = 0 then
Write-Debug loo_Imap.LastErrorText
destroy loo_Imap
return
end if
destroy loo_Imap