Sample code for 30+ languages & platforms
DataFlex

Authenticate with the POP3 Server

See more POP3 Examples

Demonstrates the Chilkat MailMan.Pop3Authenticate method, which authenticates with the POP3 server using the current POP3 property settings, such as PopUsername and PopPassword. It is typically called after Pop3Connect. This example connects and then authenticates.

Background: POP3 authentication is the step, after connecting, where the client identifies itself — classically with the USER and PASS commands, or a more secure mechanism. Calling Pop3Connect and Pop3Authenticate as distinct steps lets you determine precisely which phase fails, and lets you hold an authenticated session open to perform several mailbox operations before ending it with Pop3EndSession.

Chilkat DataFlex Downloads

DataFlex
Use ChilkatAx-win32.pkg

Procedure Test
    Boolean iSuccess
    Handle hoMailman
    String sTemp1

    Move False To iSuccess

    //  Demonstrates the MailMan.Pop3Authenticate method, which authenticates with the POP3 server
    //  using the current POP3 property settings (such as PopUsername and PopPassword).  It is
    //  typically called after Pop3Connect.

    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"

    //  Connect first, then authenticate.

    Get ComPop3Connect Of hoMailman To iSuccess
    If (iSuccess = False) Begin
        Get ComLastErrorText Of hoMailman To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    Get ComPop3Authenticate Of hoMailman To iSuccess
    If (iSuccess = False) Begin
        Get ComLastErrorText Of hoMailman To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    Showln "Authenticated with the POP3 server."


End_Procedure