Xbase++ Requires Chilkat v11.0.0+
Xbase++
Find the "Sent" IMAP Mailbox
See more IMAP Examples
Find the "Sent" IMAP mailbox. Also finds the Junk and Trash mailboxes..Chilkat Xbase++ Downloads
LOCAL nSuccess
LOCAL oImap
LOCAL cRefName
LOCAL cWildcardedMailbox
LOCAL nSubscribed
LOCAL oMboxes
LOCAL i
nSuccess := 0
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
oImap := CreateObject("Chilkat.Imap")
oImap:Ssl := 1
oImap:Port := 993
nSuccess := oImap:Connect("imap.yourmailserver.com")
IF (nSuccess == 0)
? oImap:LastErrorText
oImap:destroy()
RETURN
ENDIF
// Login or authenticate in some way..
nSuccess := oImap:Login("your_login", "your_password")
IF (nSuccess == 0)
? oImap:LastErrorText
oImap:destroy()
RETURN
ENDIF
// Get the list of mailboxes.
cRefName := ""
cWildcardedMailbox := "*"
nSubscribed := 0
oMboxes := CreateObject("Chilkat.Mailboxes")
nSuccess := oImap:MbxList(nSubscribed, cRefName, cWildcardedMailbox, oMboxes)
IF (nSuccess == 0)
? oImap:LastErrorText
oImap:destroy()
oMboxes:destroy()
RETURN
ENDIF
// The mailbox with the "/Sent" flag is the "Sent" mailbox.
// Likewise for Junk and Trash..
i := 0
DO WHILE i < oMboxes:Count
IF (oMboxes:HasFlag(i, "\Sent") == 1)
? "Sent mailbox: " + oMboxes:GetName(i)
ENDIF
IF (oMboxes:HasFlag(i, "\Junk") == 1)
? "Junk mailbox: " + oMboxes:GetName(i)
ENDIF
IF (oMboxes:HasFlag(i, "\Trash") == 1)
? "Trash mailbox: " + oMboxes:GetName(i)
ENDIF
i := i + 1
ENDDO
// Disconnect from the IMAP server.
nSuccess := oImap:Disconnect()
oImap:destroy()
oMboxes:destroy()