annotate Doc/lib/libpoplib.tex @ 21467:4e35fa5d5708 legacy-trunk

Add documentation for the help() built-in; contributed by Ka-Ping Yee. This is part of SF patch #494622.
author Fred Drake <fdrake@acm.org>
date Tue, 18 Dec 2001 16:31:08 +0000
parents 54ddc379d4fc
children 4c8a8c74f4bd
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.}
75e7814041da There is no IMAP class in the imaplib module; the class is IMAP4.
Fred Drake <fdrake@acm.org>
parents: 15813
diff changeset
43 \seetitle{http://www.tuxedo.org/~esr/fetchail/fetchmail-FAQ.html}{
75e7814041da There is no IMAP class in the imaplib module; the class is IMAP4.
Fred Drake <fdrake@acm.org>
parents: 15813
diff changeset
44 The FAQ for the fetchmail POP/IMAP client collects information
75e7814041da There is no IMAP class in the imaplib module; the class is IMAP4.
Fred Drake <fdrake@acm.org>
parents: 15813
diff changeset
45 on POP3 server variations and RFC noncompliance that may be
75e7814041da There is no IMAP class in the imaplib module; the class is IMAP4.
Fred Drake <fdrake@acm.org>
parents: 15813
diff changeset
46 useful if you need to write an application based on poplib.}
75e7814041da There is no IMAP class in the imaplib module; the class is IMAP4.
Fred Drake <fdrake@acm.org>
parents: 15813
diff changeset
47 \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
48
8141
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
49
10686
ae0306aaa688 Fix minor (English) usage nits.
Fred Drake <fdrake@acm.org>
parents: 9609
diff changeset
50 \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
51
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
52 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
53 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
54
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
55 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
56
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
57
21240
54ddc379d4fc Re-enabled debugging prints in poplib & documented the set_debuglevel()
Fred Drake <fdrake@acm.org>
parents: 19241
diff changeset
58 \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
59 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
60 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
61 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
62 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
63 \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
64 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
65 \end{methoddesc}
54ddc379d4fc Re-enabled debugging prints in poplib & documented the set_debuglevel()
Fred Drake <fdrake@acm.org>
parents: 19241
diff changeset
66
8141
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
67 \begin{methoddesc}{getwelcome}{}
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
68 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
69 \end{methoddesc}
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
70
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
71 \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
72 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
73 \end{methoddesc}
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
74
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
75 \begin{methoddesc}{pass_}{password}
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
76 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
77 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
78 called.
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
79 \end{methoddesc}
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
80
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
81 \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
82 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
83 \end{methoddesc}
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
84
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
85 \begin{methoddesc}{rpop}{user}
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
86 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
87 \end{methoddesc}
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
88
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
89 \begin{methoddesc}{stat}{}
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
90 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
91 \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
92 \end{methoddesc}
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
93
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
94 \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
95 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
96 \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
97 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
98 \end{methoddesc}
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
99
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
100 \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
101 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
102 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
103 \end{methoddesc}
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
104
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
105 \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
106 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
107 deletions are not actually performed until QUIT (the major exception is
954611fd35e1 Corrections and additions to the documentation for POP3 and IMAP library
Eric S. Raymond <esr@thyrsus.com>
parents: 13625
diff changeset
108 Eudora QPOP, which deliberately violates the RFCs by doing pending
954611fd35e1 Corrections and additions to the documentation for POP3 and IMAP library
Eric S. Raymond <esr@thyrsus.com>
parents: 13625
diff changeset
109 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
110 \end{methoddesc}
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
111
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
112 \begin{methoddesc}{rset}{}
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
113 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
114 \end{methoddesc}
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
115
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
116 \begin{methoddesc}{noop}{}
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
117 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
118 \end{methoddesc}
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
119
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
120 \begin{methoddesc}{quit}{}
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
121 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
122 \end{methoddesc}
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
123
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
124 \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
125 Retrieves the message header plus \var{howmuch} lines of the message
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
126 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
127 \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
128
954611fd35e1 Corrections and additions to the documentation for POP3 and IMAP library
Eric S. Raymond <esr@thyrsus.com>
parents: 13625
diff changeset
129 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
130 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
131 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
132 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
133 trusting it.
8141
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
134 \end{methoddesc}
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
135
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
136 \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
137 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
138 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
139 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
140 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
141 \var{octets})}.
8141
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
142 \end{methoddesc}
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
143
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
144
10686
ae0306aaa688 Fix minor (English) usage nits.
Fred Drake <fdrake@acm.org>
parents: 9609
diff changeset
145 \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
146
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
147 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
148 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
149
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
150 \begin{verbatim}
9609
c1f98857cc5b Correct the poplib example. Stephan Richter pointed out some problems
Guido van Rossum <guido@python.org>
parents: 8918
diff changeset
151 import getpass, poplib
8141
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
152
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
153 M = poplib.POP3('localhost')
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
154 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
155 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
156 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
157 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
158 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
159 print j
8141
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
160 \end{verbatim}
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
161
b148fa1525db Added a section for the poplib module, contributed by Drew Csillag.
Fred Drake <fdrake@acm.org>
parents:
diff changeset
162 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
163 extensive example of usage.