Sample code for 30+ languages & platforms
DataFlex

Get POP3 Mailbox Info as XML

See more POP3 Examples

Demonstrates the Chilkat MailMan.GetMailboxInfoXml method, which returns an XML document describing the messages currently in the POP3 mailbox — including each message's UIDL and size in bytes. This example configures the POP3 connection and prints the listing.

Tip: XML parsing code for this result can be generated at Chilkat Tools.

Background: Before downloading, it is often useful to survey what's in the mailbox. This method combines POP3's UIDL listing (a stable unique ID per message) with LIST sizes into one XML result. With it you can decide which messages to fetch or delete by UIDL — for example skipping ones already processed, or targeting only messages above a certain size.

Chilkat DataFlex Downloads

DataFlex
Use ChilkatAx-win32.pkg

Procedure Test
    Handle hoMailman
    String sXmlInfo

    //  Demonstrates the MailMan.GetMailboxInfoXml method, which returns an XML document with
    //  information about the messages currently in the POP3 mailbox, including the UIDL and size
    //  (in bytes) of each message.

    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 mailbox listing as XML.
    Get ComGetMailboxInfoXml Of hoMailman To sXmlInfo
    Showln sXmlInfo

    //  The returned XML looks similar to:
    //  
    //    <mailbox count="2" size="4786">
    //        <email uidl="UID22-1784216315" msgNum="1" size="2394" />
    //        <email uidl="UID23-1784216315" msgNum="2" size="2392" />
    //    </mailbox>
    //  
    //  XML parsing code for this result can be generated at Chilkat's online tool:
    //  https://tools.chilkat.io/xmlParse

    //  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