Sample code for 30+ languages & platforms
PureBasic

Verify POP3 Login (Connect and Authenticate)

See more POP3 Examples

Demonstrates the Chilkat MailMan.VerifyPopLogin method, which tests whether Chilkat can connect to the configured POP3 server and successfully log in using the current POP3 authentication settings. This example configures the POP3 host and credentials and verifies login.

Background: POP3 login is the USER/PASS (or APOP/SASL) exchange that follows connecting. VerifyPopLogin performs the full round trip — connect, TLS, and authenticate — making it the go-to preflight check for validating a mailbox's credentials. A false result after VerifyPopConnection succeeds isolates the problem to the username or password.

Chilkat PureBasic Downloads

PureBasic
IncludeFile "CkMailMan.pb"

Procedure ChilkatExample()

    success.i = 0

    ;  Demonstrates the MailMan.VerifyPopLogin method, which tests whether Chilkat can connect to
    ;  the configured POP3 server and successfully log in using the current POP3 authentication
    ;  settings.

    mailman.i = CkMailMan::ckCreate()
    If mailman.i = 0
        Debug "Failed to create object."
        ProcedureReturn
    EndIf

    ;  Configure the POP3 server connection.
    CkMailMan::setCkMailHost(mailman, "pop.example.com")
    CkMailMan::setCkMailPort(mailman, 995)
    CkMailMan::setCkPopSsl(mailman, 1)
    CkMailMan::setCkPopUsername(mailman, "user@example.com")
    CkMailMan::setCkPopPassword(mailman, "myPassword")

    ;  Test both connectivity and login.
    loggedIn.i = CkMailMan::ckVerifyPopLogin(mailman)

    If loggedIn = 1
        Debug "Successfully connected and logged in to the POP3 server."
    Else
        Debug "POP3 connect or login failed."
    EndIf



    CkMailMan::ckDispose(mailman)


    ProcedureReturn
EndProcedure