Sample code for 30+ languages & platforms
DataFlex

Send a POP3 NOOP Command

See more POP3 Examples

Demonstrates the Chilkat MailMan.Pop3Noop method, which sends a POP3 NOOP command to the server. NOOP does nothing except elicit a positive response, which is useful for keeping a session alive or verifying the connection is still responsive. This example begins a POP3 session and sends a NOOP.

Background: NOOP ("no operation") is a standard keep-alive across many internet protocols. Servers often drop idle connections after a timeout; sending a periodic NOOP resets that timer so a long-running session stays open. It also serves as a cheap "are you still there?" probe — a successful reply confirms the socket and the authenticated session are still healthy.

Chilkat DataFlex Downloads

DataFlex
Use ChilkatAx-win32.pkg

Procedure Test
    Boolean iSuccess
    Handle hoMailman
    String sTemp1

    Move False To iSuccess

    //  Demonstrates the MailMan.Pop3Noop method, which sends a POP3 NOOP command to the server.
    //  NOOP does nothing except elicit a positive response, which is useful for keeping a
    //  session alive or verifying the connection is still responsive.

    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"

    //  Begin a POP3 session.

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

    //  Send a NOOP to keep the session alive.
    Get ComPop3Noop Of hoMailman To iSuccess
    If (iSuccess = False) Begin
        Get ComLastErrorText Of hoMailman To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    Showln "POP3 NOOP succeeded."


End_Procedure