Xojo Plugin
Xojo Plugin
End IMAP IDLE Mode
See more IMAP Examples
Demonstrates the Chilkat Imap.IdleDone method, which ends IDLE mode by sending the protocol's DONE continuation. It takes no arguments. The authenticated connection remains open and usable afterward.
Background: While IDLE is active the connection is dedicated to receiving push notifications, so any command that needs to talk to the server — fetching a message, setting a flag — must wait until IDLE ends.
IdleDone cleanly exits IDLE without dropping the login, so the same connection can immediately be reused. Calling it when IDLE is not active fails.Chilkat Xojo Plugin Downloads
Dim success As Boolean
success = False
// Demonstrates the Imap.IdleDone method, which ends IMAP IDLE mode by sending the DONE
// continuation. It takes no arguments. The authenticated connection remains open and usable.
Dim imap As New Chilkat.Imap
imap.Ssl = True
imap.Port = 993
success = imap.Connect("imap.example.com")
If (success = False) Then
System.DebugLog(imap.LastErrorText)
Return
End If
success = imap.Login("user@example.com","myPassword")
If (success = False) Then
System.DebugLog(imap.LastErrorText)
Return
End If
success = imap.SelectMailbox("Inbox")
If (success = False) Then
System.DebugLog(imap.LastErrorText)
Return
End If
success = imap.IdleStart()
If (success = False) Then
System.DebugLog(imap.LastErrorText)
Return
End If
// Check once for any updates that arrived.
Dim timeoutMs As Int32
timeoutMs = 5000
Dim updates As String
updates = imap.IdleCheck(timeoutMs)
If (imap.LastMethodSuccess = False) Then
System.DebugLog(imap.LastErrorText)
Return
End If
System.DebugLog(updates)
// End IDLE so that ordinary IMAP commands can be sent again on the same connection.
success = imap.IdleDone()
If (success = False) Then
System.DebugLog(imap.LastErrorText)
Return
End If
System.DebugLog("IDLE mode ended.")
success = imap.Disconnect()
If (success = False) Then
System.DebugLog(imap.LastErrorText)
Return
End If