11.9.1 POP3 Objects
All POP3 commands are represented by methods of the same name, in lower-case; most return the response text sent by the server.
An POP3 instance has the following methods:
-
Set the instance's debugging level. This controls the amount of
debugging output printed. The default,
0
, produces no debugging output. A value of1
produces a moderate amount of debugging output, generally a single line per request. A value of2
or higher produces the maximum amount of debugging output, logging each line sent and received on the control connection.
- Returns the greeting string sent by the POP3 server.
- Send user command, response should indicate that a password is required.
- Send password, response includes message count and mailbox size. Note: the mailbox on the server is locked until quit() is called.
- Use the more secure APOP authentication to log into the POP3 server.
- Use RPOP authentication (similar to UNIX r-commands) to log into POP3 server.
-
Get mailbox status. The result is a tuple of 2 integers:
(message count, mailbox size)
.
-
Request message list, result is in the form
(response, ['mesg_num octets', ...], octets)
. If which is set, it is the message to list.
-
Retrieve whole message number which, and set its seen flag.
Result is in form
(response, ['line', ...], octets)
.
- Flag message number which for deletion. On most servers deletions are not actually performed until QUIT (the major exception is Eudora QPOP, which deliberately violates the RFCs by doing pending deletes on any disconnect).
- Remove any deletion marks for the mailbox.
- Do nothing. Might be used as a keep-alive.
- Signoff: commit changes, unlock mailbox, drop connection.
-
Retrieves the message header plus howmuch lines of the message
after the header of message number which. Result is in form
(response, ['line', ...], octets)
.The POP3 TOP command this method uses, unlike the RETR command, doesn't set the message's seen flag; unfortunately, TOP is poorly specified in the RFCs and is frequently broken in off-brand servers. Test this method by hand against the POP3 servers you will use before trusting it.
-
Return message digest (unique id) list.
If which is specified, result contains the unique id for that
message in the form
'response mesgnum uid
, otherwise result is list(response, ['mesgnum uid', ...], octets)
.
Instances of POP3_SSL have no additional methods. The interface of this subclass is identical to its parent.
See About this document... for information on suggesting changes.