DataFlex
DataFlex
Fetch the UIDLs of All POP3 Messages
See more POP3 Examples
Demonstrates the Chilkat MailMan.FetchUidls method, which retrieves the UIDLs of the messages currently in the POP3 mailbox and stores them in a StringTable, one entry per message, in the server's current mailbox order. This example lists every UIDL.
Background: The UIDL list is the starting point for incremental mail retrieval. A client keeps a record of the UIDLs it has already downloaded; on each check it fetches the current list, computes the difference, and downloads only the new ones (see
FetchUidlSet). This is how "leave a copy on the server" works without repeatedly re-downloading the same messages.Chilkat DataFlex Downloads
Use ChilkatAx-win32.pkg
Procedure Test
Boolean iSuccess
Handle hoMailman
Variant vUidls
Handle hoUidls
Integer n
Integer i
String sTemp1
Move False To iSuccess
// Demonstrates the MailMan.FetchUidls method, which retrieves the UIDLs of the messages
// currently in the POP3 mailbox and stores them in a StringTable, one entry per message, in
// the server's current mailbox order.
Get Create (RefClass(cComChilkatMailMan)) To hoMailman
If (Not(IsComObjectCreated(hoMailman))) Begin
Send CreateComObject of hoMailman
End
// Configure the POP3 server connection.
Set ComMailHost Of hoMailman To "pop.example.com"
Set ComMailPort Of hoMailman To 995
Set ComPopSsl Of hoMailman To True
Set ComPopUsername Of hoMailman To "user@example.com"
Set ComPopPassword Of hoMailman To "myPassword"
// Retrieve the UIDLs of all messages in the mailbox.
Get Create (RefClass(cComChilkatStringTable)) To hoUidls
If (Not(IsComObjectCreated(hoUidls))) Begin
Send CreateComObject of hoUidls
End
Get pvComObject of hoUidls to vUidls
Get ComFetchUidls Of hoMailman vUidls To iSuccess
If (iSuccess = False) Begin
Get ComLastErrorText Of hoMailman To sTemp1
Showln sTemp1
Procedure_Return
End
Get ComCount Of hoUidls To n
Showln "Mailbox contains " n " messages."
For i From 0 To (n - 1)
Get ComStringAt Of hoUidls i To sTemp1
Showln "UIDL " i ": " sTemp1
Loop
// Note: Explicitly connecting/authenticating is optional. Chilkat MailMan automatically
// connects and authenticates -- using the property settings above -- whenever a server
// operation requires it. Calling the explicit connect/authenticate methods can still be
// helpful to determine whether a failure occurs while connecting or while authenticating.
End_Procedure