Sample code for 30+ languages & platforms
DataFlex

Retrieve UIDL's from POP3 Server

Retrieve a list of UIDLs from a POP3 server. UIDLs are unique identifiers, 1 to 70 characters long, composed of characters ranging from 0x21 to 0x7E. These identifiers uniquely distinguish messages within a mailbox and remain consistent across sessions.

Chilkat DataFlex Downloads

DataFlex
Use ChilkatAx-win32.pkg

Procedure Test
    Boolean iSuccess
    Handle hoMailman
    Variant vStUidls
    Handle hoStUidls
    Variant vEmail
    Handle hoEmail
    Integer iCount
    Integer i
    String sUidl
    String sTemp1

    Move False To iSuccess

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

    Get Create (RefClass(cComChilkatMailMan)) To hoMailman
    If (Not(IsComObjectCreated(hoMailman))) Begin
        Send CreateComObject of hoMailman
    End

    Set ComMailHost Of hoMailman To "pop.example.com"

    Set ComPopUsername Of hoMailman To "myLogin"
    Set ComPopPassword Of hoMailman To "myPassword"

    Set ComMailPort Of hoMailman To 995
    Set ComPopSsl Of hoMailman To True

    Get Create (RefClass(cComChilkatStringTable)) To hoStUidls
    If (Not(IsComObjectCreated(hoStUidls))) Begin
        Send CreateComObject of hoStUidls
    End
    Get pvComObject of hoStUidls to vStUidls
    Get ComFetchUidls Of hoMailman vStUidls To iSuccess
    If (iSuccess = False) Begin
        Get ComLastErrorText Of hoMailman To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    // Download each email by UIDL.
    Get Create (RefClass(cComChilkatEmail)) To hoEmail
    If (Not(IsComObjectCreated(hoEmail))) Begin
        Send CreateComObject of hoEmail
    End

    Get ComCount Of hoStUidls To iCount
    Move 0 To i
    While (i < iCount)
        // Download the full email.
        Get ComStringAt Of hoStUidls i To sUidl
        Get pvComObject of hoEmail to vEmail
        Get ComFetchByUidl Of hoMailman sUidl False 0 vEmail To iSuccess
        If (iSuccess = False) Begin
            Get ComLastErrorText Of hoMailman To sTemp1
            Showln sTemp1
            Procedure_Return
        End

        Showln i
        Showln "UIDL: " sUidl
        Get ComFrom Of hoEmail To sTemp1
        Showln "From: " sTemp1
        Get ComSubject Of hoEmail To sTemp1
        Showln "Subject: " sTemp1

        Move (i + 1) To i
    Loop

    Get ComPop3EndSession Of hoMailman To iSuccess


End_Procedure