Sample code for 30+ languages & platforms
AutoIt Requires Chilkat v11.0.0+

Find the "Sent" IMAP Mailbox

See more IMAP Examples

Find the "Sent" IMAP mailbox. Also finds the Junk and Trash mailboxes..

Chilkat AutoIt Downloads

AutoIt
Local $bSuccess = False

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

$oImap = ObjCreate("Chilkat.Imap")

$oImap.Ssl = True
$oImap.Port = 993
$bSuccess = $oImap.Connect("imap.yourmailserver.com")
If ($bSuccess = False) Then
    ConsoleWrite($oImap.LastErrorText & @CRLF)
    Exit
EndIf

;  Login or authenticate in some way..
$bSuccess = $oImap.Login("your_login","your_password")
If ($bSuccess = False) Then
    ConsoleWrite($oImap.LastErrorText & @CRLF)
    Exit
EndIf

;  Get the list of mailboxes.
Local $sRefName = ""
Local $sWildcardedMailbox = "*"
Local $bSubscribed = False

$oMboxes = ObjCreate("Chilkat.Mailboxes")
$bSuccess = $oImap.MbxList($bSubscribed,$sRefName,$sWildcardedMailbox,$oMboxes)
If ($bSuccess = False) Then
    ConsoleWrite($oImap.LastErrorText & @CRLF)
    Exit
EndIf

;  The mailbox with the "/Sent" flag is the "Sent" mailbox.
;  Likewise for Junk and Trash..
Local $i = 0
While $i < $oMboxes.Count
    If ($oMboxes.HasFlag($i,"\Sent") = True) Then
        ConsoleWrite("Sent mailbox: " & $oMboxes.GetName($i) & @CRLF)
    EndIf

    If ($oMboxes.HasFlag($i,"\Junk") = True) Then
        ConsoleWrite("Junk mailbox: " & $oMboxes.GetName($i) & @CRLF)
    EndIf

    If ($oMboxes.HasFlag($i,"\Trash") = True) Then
        ConsoleWrite("Trash mailbox: " & $oMboxes.GetName($i) & @CRLF)
    EndIf

    $i = $i + 1
Wend

;  Disconnect from the IMAP server.
$bSuccess = $oImap.Disconnect()