On this page
poplib.POP3
Prev: poplib.error_proto | Up: poplib | Next: poplib.POP3_SSL
Rel: poplib.error_proto, poplib.POP3_SSL
Ref: docs.python.org — poplib.POP3
Tags: #public #python3 #stdlib #poplib
Import
import poplib
from poplib import POP3
Signature & Overview
poplib.POP3(host, port=110, timeout=<object object at 0x1040b4980>)
This class supports both the minimal and optional command sets.
Methods & Attributes
POP3.apop(self, user, password)— Authorisation - only possible if server has supplied a timestamp in initial greeting.POP3.capa(self)— Return server capabilities (RFC 2449) as a dictionary >>> c=poplib.POP3('localhost') >>> c.capa()POP3.close(self)— Close the connection without assuming anything about it.POP3.dele(self, which)— Delete message number 'which'.POP3.getwelcome(self)—POP3.getwelcomemethod/property.POP3.list(self, which=None)— Request listing, return result.POP3.noop(self)— Does nothing.POP3.pass_(self, pswd)— Send password, return response (response includes message count, mailbox size).POP3.quit(self)— Signoff: commit changes on server, unlock mailbox, close connection.POP3.retr(self, which)— Retrieve whole message number 'which'.POP3.rpop(self, user)— Send RPOP command to access the mailbox with an alternate user.POP3.rset(self)— Unmark all messages marked for deletion.POP3.set_debuglevel(self, level)—POP3.set_debuglevelmethod/property.POP3.stat(self)— Get mailbox status.POP3.stls(self, context=None)— Start a TLS session on the active connection as specified in RFC 2595.POP3.top(self, which, howmuch)— Retrieve message header of message number 'which' and first 'howmuch' lines of message body.POP3.uidl(self, which=None)— Return message digest (unique id) list.POP3.user(self, user)— Send user name, return response (should indicate password required).POP3.utf8(self)— Try to enter UTF-8 mode (see RFC 6856). Returns server response.
Usage
import poplib
# Plaintext POP3 client (prefer POP3_SSL on port 995)
assert hasattr(poplib, "POP3")
Gotchas
- Not a context manager: Always call
conn.quit()in afinally:block so deletions commit and the mailbox lock is released.
REPL Inspect
from poplib import POP3
help(POP3)
Linked from
Related notes
- tuts/python3/stdlib_module/poplib/error_proto Linked here; links to this page; shared tags: #poplib, #stdlib
- tuts/python3/stdlib_module/poplib/POP3_SSL Linked here; links to this page; shared tags: #poplib, #stdlib
- tuts/python3/stdlib_module/poplib Linked here; links to this page; shared tags: #stdlib
- tuts/c/stdlib shared tags: #stdlib
- tuts/c/stdlib/assert shared tags: #stdlib
- tuts/c/stdlib/assert/assert shared tags: #stdlib
- tuts/c/stdlib/assert/static_assert shared tags: #stdlib
- tuts/c/stdlib/ctype shared tags: #stdlib
- tuts/c/stdlib/ctype/isalpha shared tags: #stdlib
- tuts/c/stdlib/ctype/isdigit shared tags: #stdlib