annotate Doc/lib/libpoplib.tex @ 27998:e27f58a50737 legacy-trunk

SF bug #690377: Dud footnote reference in distutils docs
author Raymond Hettinger <python@rcn.com>
date Fri, 21 Feb 2003 02:47:09 +0000
parents 4c8a8c74f4bd
children 1510244beb5e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
8918
acfffe14628e New section header style.
Fred Drake <fdrake@acm.org>
parents: 8716
diff changeset
1 \section{\module{poplib} ---
10686
ae0306aaa688 Fix minor (English) usage nits.
Fred Drake <fdrake@acm.org>
parents: 9609
diff changeset
2 POP3 protocol client}
ae0306aaa688 Fix minor (English) usage nits.
Fred Drake <fdrake@acm.org>
parents: 9609
diff changeset
3
8716
760dcf197048 Adjusted to use the new module synopsis support macros.
Fred Drake <fdrake@acm.org>
parents: 8141
diff changeset
4 \declaremodule{standard}{poplib}
760dcf197048 Adjusted to use the new module synopsis support macros.
Fred Drake <fdrake@acm.org>
parents: 8141
diff changeset
5 \modulesynopsis{POP3 protocol client (requires sockets).}
760dcf197048 Adjusted to use the new module synopsis support macros.
Fred Drake <fdrake@acm.org>
parents: 8141
diff changeset
6
12223
e82e82b3b9ad Merged changes from the 1.5.2p2 release.
Fred Drake <fdrake@acm.org>
parents: 11112
diff changeset
7 %By Andrew T. Csillag
e82e82b3b9ad Merged changes from the 1.5.2p2 release.
Fred Drake <fdrake@acm.org>
parents: 11112
diff changeset
8 %Even though I put it into LaTeX, I cannot really claim that I wrote
e82e82b3b9ad Merged changes from the 1.5.2p2 release.
Fred Drake <fdrake@acm.org>
parents: 11112
diff changeset
9 %it since I just stole most of it from the poplib.py source code and
e82e82b3b9ad Merged changes from the 1.5.2p2 release.
Fred Drake <fdrake@acm.org>
parents: 11112
diff changeset
10 %the imaplib ``chapter''.
15810
954611fd35e1 Corrections and additions to the documentation for POP3 and IMAP library
Eric S. Raymond <esr@thyrsus.com>
parents: 13625
diff changeset
11 %Revised by ESR, January 2000
12223
e82e82b3b9ad Merged changes from the 1.5.2p2 release.
Fred Drake <fdrake@acm.org>
parents: 11112
diff changeset
12
8141
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
13 \indexii{POP3}{protocol}
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
14
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
15 This module defines a class, \class{POP3}, which encapsulates a
19241
d3dd0f2fb1f4 Insert omitted "the".
Fred Drake <fdrake@acm.org>
parents: 17716
diff changeset
16 connection to an POP3 server and implements the protocol as defined in
13625
fdfd1049f36e Rob W. W. Hooft's spelling fixes for the Library Reference. I hope
Thomas Wouters <thomas@python.org>
parents: 12223
diff changeset
17 \rfc{1725}. The \class{POP3} class supports both the minimal and
8141
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
18 optional command sets.
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
19
15810
954611fd35e1 Corrections and additions to the documentation for POP3 and IMAP library
Eric S. Raymond <esr@thyrsus.com>
parents: 13625
diff changeset
20 Note that POP3, though widely supported, is obsolescent. The
954611fd35e1 Corrections and additions to the documentation for POP3 and IMAP library
Eric S. Raymond <esr@thyrsus.com>
parents: 13625
diff changeset
21 implementation quality of POP3 servers varies widely, and too many are
954611fd35e1 Corrections and additions to the documentation for POP3 and IMAP library
Eric S. Raymond <esr@thyrsus.com>
parents: 13625
diff changeset
22 quite poor. If your mailserver supports IMAP, you would be better off
17716
75e7814041da There is no IMAP class in the imaplib module; the class is IMAP4.
Fred Drake <fdrake@acm.org>
parents: 15813
diff changeset
23 using the \code{\refmodule{imaplib}.\class{IMAP4}} class, as IMAP
75e7814041da There is no IMAP class in the imaplib module; the class is IMAP4.
Fred Drake <fdrake@acm.org>
parents: 15813
diff changeset
24 servers tend to be better implemented.
15810
954611fd35e1 Corrections and additions to the documentation for POP3 and IMAP library
Eric S. Raymond <esr@thyrsus.com>
parents: 13625
diff changeset
25
8141
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
26 A single class is provided by the \module{poplib} module:
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
27
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
28 \begin{classdesc}{POP3}{host\optional{, port}}
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
29 This class implements the actual POP3 protocol. The connection is
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
30 created when the instance is initialized.
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
31 If \var{port} is omitted, the standard POP3 port (110) is used.
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
32 \end{classdesc}
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
33
10686
ae0306aaa688 Fix minor (English) usage nits.
Fred Drake <fdrake@acm.org>
parents: 9609
diff changeset
34 One exception is defined as an attribute of the \module{poplib} module:
8141
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
35
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
36 \begin{excdesc}{error_proto}
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
37 Exception raised on any errors. The reason for the exception is
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
38 passed to the constructor as a string.
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
39 \end{excdesc}
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
40
17716
75e7814041da There is no IMAP class in the imaplib module; the class is IMAP4.
Fred Drake <fdrake@acm.org>
parents: 15813
diff changeset
41 \begin{seealso}
75e7814041da There is no IMAP class in the imaplib module; the class is IMAP4.
Fred Drake <fdrake@acm.org>
parents: 15813
diff changeset
42 \seemodule{imaplib}{The standard Python IMAP module.}
25859
4c8a8c74f4bd Fix reference to the Fetchmail FAQ:
Fred Drake <fdrake@acm.org>
parents: 21240
diff changeset
43 \seetitle[http://www.tuxedo.org/\~{}esr/fetchmail/fetchmail-FAQ.html]
4c8a8c74f4bd Fix reference to the Fetchmail FAQ:
Fred Drake <fdrake@acm.org>
parents: 21240
diff changeset
44 {Frequently Asked Questions About Fetchmail}
4c8a8c74f4bd Fix reference to the Fetchmail FAQ:
Fred Drake <fdrake@acm.org>
parents: 21240
diff changeset
45 {The FAQ for the \program{fetchmail} POP/IMAP client collects
4c8a8c74f4bd Fix reference to the Fetchmail FAQ:
Fred Drake <fdrake@acm.org>
parents: 21240
diff changeset
46 information on POP3 server variations and RFC noncompliance
4c8a8c74f4bd Fix reference to the Fetchmail FAQ:
Fred Drake <fdrake@acm.org>
parents: 21240
diff changeset
47 that may be useful if you need to write an application based
4c8a8c74f4bd Fix reference to the Fetchmail FAQ:
Fred Drake <fdrake@acm.org>
parents: 21240
diff changeset
48 on the POP protocol.}
17716
75e7814041da There is no IMAP class in the imaplib module; the class is IMAP4.
Fred Drake <fdrake@acm.org>
parents: 15813
diff changeset
49 \end{seealso}
75e7814041da There is no IMAP class in the imaplib module; the class is IMAP4.
Fred Drake <fdrake@acm.org>
parents: 15813
diff changeset
50
8141
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
51
10686
ae0306aaa688 Fix minor (English) usage nits.
Fred Drake <fdrake@acm.org>
parents: 9609
diff changeset
52 \subsection{POP3 Objects \label{pop3-objects}}
8141
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
53
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
54 All POP3 commands are represented by methods of the same name,
10686
ae0306aaa688 Fix minor (English) usage nits.
Fred Drake <fdrake@acm.org>
parents: 9609
diff changeset
55 in lower-case; most return the response text sent by the server.
8141
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
56
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
57 An \class{POP3} instance has the following methods:
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
58
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
59
21240
54ddc379d4fc Re-enabled debugging prints in poplib & documented the set_debuglevel()
Fred Drake <fdrake@acm.org>
parents: 19241
diff changeset
60 \begin{methoddesc}{set_debuglevel}{level}
54ddc379d4fc Re-enabled debugging prints in poplib & documented the set_debuglevel()
Fred Drake <fdrake@acm.org>
parents: 19241
diff changeset
61 Set the instance's debugging level. This controls the amount of
54ddc379d4fc Re-enabled debugging prints in poplib & documented the set_debuglevel()
Fred Drake <fdrake@acm.org>
parents: 19241
diff changeset
62 debugging output printed. The default, \code{0}, produces no
54ddc379d4fc Re-enabled debugging prints in poplib & documented the set_debuglevel()
Fred Drake <fdrake@acm.org>
parents: 19241
diff changeset
63 debugging output. A value of \code{1} produces a moderate amount of
54ddc379d4fc Re-enabled debugging prints in poplib & documented the set_debuglevel()
Fred Drake <fdrake@acm.org>
parents: 19241
diff changeset
64 debugging output, generally a single line per request. A value of
54ddc379d4fc Re-enabled debugging prints in poplib & documented the set_debuglevel()
Fred Drake <fdrake@acm.org>
parents: 19241
diff changeset
65 \code{2} or higher produces the maximum amount of debugging output,
54ddc379d4fc Re-enabled debugging prints in poplib & documented the set_debuglevel()
Fred Drake <fdrake@acm.org>
parents: 19241
diff changeset
66 logging each line sent and received on the control connection.
54ddc379d4fc Re-enabled debugging prints in poplib & documented the set_debuglevel()
Fred Drake <fdrake@acm.org>
parents: 19241
diff changeset
67 \end{methoddesc}
54ddc379d4fc Re-enabled debugging prints in poplib & documented the set_debuglevel()
Fred Drake <fdrake@acm.org>
parents: 19241
diff changeset
68
8141
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
69 \begin{methoddesc}{getwelcome}{}
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
70 Returns the greeting string sent by the POP3 server.
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
71 \end{methoddesc}
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
72
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
73 \begin{methoddesc}{user}{username}
13625
fdfd1049f36e Rob W. W. Hooft's spelling fixes for the Library Reference. I hope
Thomas Wouters <thomas@python.org>
parents: 12223
diff changeset
74 Send user command, response should indicate that a password is required.
8141
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
75 \end{methoddesc}
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
76
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
77 \begin{methoddesc}{pass_}{password}
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
78 Send password, response includes message count and mailbox size.
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
79 Note: the mailbox on the server is locked until \method{quit()} is
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
80 called.
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
81 \end{methoddesc}
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
82
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
83 \begin{methoddesc}{apop}{user, secret}
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
84 Use the more secure APOP authentication to log into the POP3 server.
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
85 \end{methoddesc}
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
86
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
87 \begin{methoddesc}{rpop}{user}
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
88 Use RPOP authentication (similar to UNIX r-commands) to log into POP3 server.
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
89 \end{methoddesc}
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
90
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
91 \begin{methoddesc}{stat}{}
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
92 Get mailbox status. The result is a tuple of 2 integers:
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
93 \code{(\var{message count}, \var{mailbox size})}.
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
94 \end{methoddesc}
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
95
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
96 \begin{methoddesc}{list}{\optional{which}}
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
97 Request message list, result is in the form
11112
78f5bf179750 Several methods return tuples, not lists.
Fred Drake <fdrake@acm.org>
parents: 10853
diff changeset
98 \code{(\var{response}, ['mesg_num octets', ...])}. If \var{which} is
8141
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
99 set, it is the message to list.
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
100 \end{methoddesc}
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
101
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
102 \begin{methoddesc}{retr}{which}
15810
954611fd35e1 Corrections and additions to the documentation for POP3 and IMAP library
Eric S. Raymond <esr@thyrsus.com>
parents: 13625
diff changeset
103 Retrieve whole message number \var{which}, and set its seen flag.
954611fd35e1 Corrections and additions to the documentation for POP3 and IMAP library
Eric S. Raymond <esr@thyrsus.com>
parents: 13625
diff changeset
104 Result is in form \code{(\var{response}, ['line', ...], \var{octets})}.
8141
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
105 \end{methoddesc}
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
106
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
107 \begin{methoddesc}{dele}{which}
15810
954611fd35e1 Corrections and additions to the documentation for POP3 and IMAP library
Eric S. Raymond <esr@thyrsus.com>
parents: 13625
diff changeset
108 Flag message number \var{which} for deletion. On most servers
954611fd35e1 Corrections and additions to the documentation for POP3 and IMAP library
Eric S. Raymond <esr@thyrsus.com>
parents: 13625
diff changeset
109 deletions are not actually performed until QUIT (the major exception is
25859
4c8a8c74f4bd Fix reference to the Fetchmail FAQ:
Fred Drake <fdrake@acm.org>
parents: 21240
diff changeset
110 Eudora QPOP, which deliberately violates the RFCs by doing pending
15810
954611fd35e1 Corrections and additions to the documentation for POP3 and IMAP library
Eric S. Raymond <esr@thyrsus.com>
parents: 13625
diff changeset
111 deletes on any disconnect).
8141
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
112 \end{methoddesc}
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
113
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
114 \begin{methoddesc}{rset}{}
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
115 Remove any deletion marks for the mailbox.
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
116 \end{methoddesc}
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
117
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
118 \begin{methoddesc}{noop}{}
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
119 Do nothing. Might be used as a keep-alive.
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
120 \end{methoddesc}
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
121
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
122 \begin{methoddesc}{quit}{}
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
123 Signoff: commit changes, unlock mailbox, drop connection.
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
124 \end{methoddesc}
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
125
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
126 \begin{methoddesc}{top}{which, howmuch}
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
127 Retrieves the message header plus \var{howmuch} lines of the message
25859
4c8a8c74f4bd Fix reference to the Fetchmail FAQ:
Fred Drake <fdrake@acm.org>
parents: 21240
diff changeset
128 after the header of message number \var{which}. Result is in form
11112
78f5bf179750 Several methods return tuples, not lists.
Fred Drake <fdrake@acm.org>
parents: 10853
diff changeset
129 \code{(\var{response}, ['line', ...], \var{octets})}.
15810
954611fd35e1 Corrections and additions to the documentation for POP3 and IMAP library
Eric S. Raymond <esr@thyrsus.com>
parents: 13625
diff changeset
130
954611fd35e1 Corrections and additions to the documentation for POP3 and IMAP library
Eric S. Raymond <esr@thyrsus.com>
parents: 13625
diff changeset
131 The POP3 TOP command this method uses, unlike the RETR command,
954611fd35e1 Corrections and additions to the documentation for POP3 and IMAP library
Eric S. Raymond <esr@thyrsus.com>
parents: 13625
diff changeset
132 doesn't set the message's seen flag; unfortunately, TOP is poorly
954611fd35e1 Corrections and additions to the documentation for POP3 and IMAP library
Eric S. Raymond <esr@thyrsus.com>
parents: 13625
diff changeset
133 specified in the RFCs and is frequently broken in off-brand servers.
954611fd35e1 Corrections and additions to the documentation for POP3 and IMAP library
Eric S. Raymond <esr@thyrsus.com>
parents: 13625
diff changeset
134 Test this method by hand against the POP3 servers you will use before
954611fd35e1 Corrections and additions to the documentation for POP3 and IMAP library
Eric S. Raymond <esr@thyrsus.com>
parents: 13625
diff changeset
135 trusting it.
8141
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
136 \end{methoddesc}
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
137
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
138 \begin{methoddesc}{uidl}{\optional{which}}
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
139 Return message digest (unique id) list.
10853
e2fe65e87761 POP3.uidl(): Update description based on comments from Piers Lauder
Fred Drake <fdrake@acm.org>
parents: 10686
diff changeset
140 If \var{which} is specified, result contains the unique id for that
e2fe65e87761 POP3.uidl(): Update description based on comments from Piers Lauder
Fred Drake <fdrake@acm.org>
parents: 10686
diff changeset
141 message in the form \code{'\var{response}\ \var{mesgnum}\ \var{uid}},
11112
78f5bf179750 Several methods return tuples, not lists.
Fred Drake <fdrake@acm.org>
parents: 10853
diff changeset
142 otherwise result is list \code{(\var{response}, ['mesgnum uid', ...],
78f5bf179750 Several methods return tuples, not lists.
Fred Drake <fdrake@acm.org>
parents: 10853
diff changeset
143 \var{octets})}.
8141
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
144 \end{methoddesc}
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
145
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
146
10686
ae0306aaa688 Fix minor (English) usage nits.
Fred Drake <fdrake@acm.org>
parents: 9609
diff changeset
147 \subsection{POP3 Example \label{pop3-example}}
8141
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
148
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
149 Here is a minimal example (without error checking) that opens a
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
150 mailbox and retrieves and prints all messages:
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
151
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
152 \begin{verbatim}
9609
c1f98857cc5b Correct the poplib example. Stephan Richter pointed out some problems
Guido van Rossum <guido@python.org>
parents: 8918
diff changeset
153 import getpass, poplib
8141
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
154
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
155 M = poplib.POP3('localhost')
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
156 M.user(getpass.getuser())
9609
c1f98857cc5b Correct the poplib example. Stephan Richter pointed out some problems
Guido van Rossum <guido@python.org>
parents: 8918
diff changeset
157 M.pass_(getpass.getpass())
8141
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
158 numMessages = len(M.list()[1])
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
159 for i in range(numMessages):
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
160 for j in M.retr(i+1)[1]:
9609
c1f98857cc5b Correct the poplib example. Stephan Richter pointed out some problems
Guido van Rossum <guido@python.org>
parents: 8918
diff changeset
161 print j
8141
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
162 \end{verbatim}
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
163
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
164 At the end of the module, there is a test section that contains a more
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
165 extensive example of usage.