pythonpop3poplib

Does a pop3 connection timeout?


I am using python poplib.

Does a POP3 connection timeout after a period of inactivity? Is there a way to set this timeout? Would such a timeout cause emails flagged for deletion to be deleted as if quit() had been called?

The only timeout I see mentioned refers to the connection-attempt timeout

class poplib.POP3(host[, port[, timeout]])

My POP3.quit() call is throwing a poplib.error_proto exception with the message "timed out" and I am wondering if the connection will ever timeout on its own.


Solution

  • Does a POP3 connection timeout after a period of inactivity?

    This mostly depends on the server software on the other end. Some socket libraries may let you specify a local timeout. The connection will timeout at whatever time is the shortest between the local and the remote timeout.

    Is there a way to set this timeout?

    Unless you control the server software settings (e.g. you run your own server), you can't change the remote timeout.

    Would such a timeout cause emails flagged for deletion to be deleted as if quit() had been called?

    Timeout behavior is usually the same as manually closing the socket (with or without shutdown). If you don't send the quit command, messages won't be deleted from the server.