Sample code for 30+ languages & platforms
PureBasic

Clear the POP3 Session Log

See more POP3 Examples

Demonstrates the Chilkat MailMan.ClearPop3SessionLog method, which clears the current contents of the Pop3SessionLog property. This example performs a POP3 operation (which populates the log) and then clears it.

Background: The Pop3SessionLog accumulates the raw protocol conversation — the commands Chilkat sent and the server's replies — which is invaluable for diagnosing connection or authentication problems. When performing many operations on one MailMan object, the log grows continuously; ClearPop3SessionLog resets it so you can capture just the exchange for the next operation.

Chilkat PureBasic Downloads

PureBasic
IncludeFile "CkMailMan.pb"

Procedure ChilkatExample()

    ;  Demonstrates the MailMan.ClearPop3SessionLog method, which clears the current contents of
    ;  the Pop3SessionLog property.

    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")

    ;  Perform a POP3 operation, which populates the session log.
    count.i = CkMailMan::ckGetMailboxCount(mailman)
    Debug "Mailbox count: " + Str(count)

    ;  Clear the POP3 session log (for example, before the next operation).
    CkMailMan::ckClearPop3SessionLog(mailman)

    Debug "POP3 session log cleared."

    ;  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.


    CkMailMan::ckDispose(mailman)


    ProcedureReturn
EndProcedure