DataFlex
DataFlex
Open an IMAP Mailbox Read-Only
See more IMAP Examples
Demonstrates the Chilkat Imap.ExamineMailbox method, which opens a mailbox as read-only. Use it instead of SelectMailbox when the application must not change message state, such as the \Seen flag. This example examines the Inbox.
Background: Reading a message can have a side effect: fetching its body normally sets the
\Seen flag, marking it as read. ExamineMailbox corresponds to IMAP's EXAMINE command, which opens the mailbox in a read-only mode where no such changes are made — ideal for scanning, indexing, or backup tools that must leave the user's mailbox exactly as they left it.Chilkat DataFlex Downloads
Use ChilkatAx-win32.pkg
Procedure Test
Boolean iSuccess
Handle hoImap
String sTemp1
Move False To iSuccess
// Demonstrates the Imap.ExamineMailbox method, which opens a mailbox as read-only. Use this
// instead of SelectMailbox when the application must not change message state (such as the
// \Seen flag).
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
Get ComLogin Of hoImap "user@example.com" "myPassword" To iSuccess
If (iSuccess = False) Begin
Get ComLastErrorText Of hoImap To sTemp1
Showln sTemp1
Procedure_Return
End
// Open the Inbox as read-only.
Get ComExamineMailbox Of hoImap "Inbox" To iSuccess
If (iSuccess = False) Begin
Get ComLastErrorText Of hoImap To sTemp1
Showln sTemp1
Procedure_Return
End
Showln "Inbox opened read-only."
Get ComDisconnect Of hoImap To iSuccess
If (iSuccess = False) Begin
Get ComLastErrorText Of hoImap To sTemp1
Showln sTemp1
Procedure_Return
End
End_Procedure