📄 pop3-objects.html
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>11.7.1 POP3 Objects </title>
<META NAME="description" CONTENT="11.7.1 POP3 Objects ">
<META NAME="keywords" CONTENT="lib">
<META NAME="resource-type" CONTENT="document">
<META NAME="distribution" CONTENT="global">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="STYLESHEET" href="lib.css" tppabs="http://www.python.org/doc/current/lib/lib.css">
<LINK REL="next" href="pop3-example.html" tppabs="http://www.python.org/doc/current/lib/pop3-example.html">
<LINK REL="previous" href="module-poplib.html" tppabs="http://www.python.org/doc/current/lib/module-poplib.html">
<LINK REL="up" href="module-poplib.html" tppabs="http://www.python.org/doc/current/lib/module-poplib.html">
<LINK REL="next" href="pop3-example.html" tppabs="http://www.python.org/doc/current/lib/pop3-example.html">
</head>
<body>
<DIV CLASS="navigation"><table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td><A href="module-poplib.html" tppabs="http://www.python.org/doc/current/lib/module-poplib.html"><img src="previous.gif" tppabs="http://www.python.org/doc/current/icons/previous.gif" border="0" height="32"
alt="Previous Page" width="32"></A></td>
<td><A href="module-poplib.html" tppabs="http://www.python.org/doc/current/lib/module-poplib.html"><img src="up.gif" tppabs="http://www.python.org/doc/current/icons/up.gif" border="0" height="32"
alt="Up One Level" width="32"></A></td>
<td><A href="pop3-example.html" tppabs="http://www.python.org/doc/current/lib/pop3-example.html"><img src="next.gif" tppabs="http://www.python.org/doc/current/icons/next.gif" border="0" height="32"
alt="Next Page" width="32"></A></td>
<td align="center" width="100%">Python Library Reference</td>
<td><A href="contents.html" tppabs="http://www.python.org/doc/current/lib/contents.html"><img src="contents.gif" tppabs="http://www.python.org/doc/current/icons/contents.gif" border="0" height="32"
alt="Contents" width="32"></A></td>
<td><a href="modindex.html" tppabs="http://www.python.org/doc/current/lib/modindex.html" title="Module Index"><img src="modules.gif" tppabs="http://www.python.org/doc/current/icons/modules.gif" border="0" height="32"
alt="Module Index" width="32"></a></td>
<td><A href="genindex.html" tppabs="http://www.python.org/doc/current/lib/genindex.html"><img src="index.gif" tppabs="http://www.python.org/doc/current/icons/index.gif" border="0" height="32"
alt="Index" width="32"></A></td>
</tr></table>
<b class="navlabel">Previous:</b> <a class="sectref" href="module-poplib.html" tppabs="http://www.python.org/doc/current/lib/module-poplib.html">11.7 poplib </A>
<b class="navlabel">Up:</b> <a class="sectref" href="module-poplib.html" tppabs="http://www.python.org/doc/current/lib/module-poplib.html">11.7 poplib </A>
<b class="navlabel">Next:</b> <a class="sectref" href="pop3-example.html" tppabs="http://www.python.org/doc/current/lib/pop3-example.html">11.7.2 POP3 Example</A>
<br><hr></DIV>
<!--End of Navigation Panel-->
<H2>
<BR>
11.7.1 POP3 Objects
</H2>
<P>
All POP3 commands are represented by methods of the same name,
in lower-case; most return the response text sent by the server.
<P>
An <tt class="class">POP3</tt> instance has the following methods:
<P>
<dl><dt><b><a name='l2h-2076'><tt class='method'>getwelcome</tt></a></b> ()
<dd>
Returns the greeting string sent by the POP3 server.
</dl>
<P>
<dl><dt><b><a name='l2h-2077'><tt class='method'>user</tt></a></b> (<var>username</var>)
<dd>
Send user command, response should indicate that a password is required.
</dl>
<P>
<dl><dt><b><a name='l2h-2078'><tt class='method'>pass_</tt></a></b> (<var>password</var>)
<dd>
Send password, response includes message count and mailbox size.
Note: the mailbox on the server is locked until <tt class="method">quit()</tt> is
called.
</dl>
<P>
<dl><dt><b><a name='l2h-2079'><tt class='method'>apop</tt></a></b> (<var>user, secret</var>)
<dd>
Use the more secure APOP authentication to log into the POP3 server.
</dl>
<P>
<dl><dt><b><a name='l2h-2080'><tt class='method'>rpop</tt></a></b> (<var>user</var>)
<dd>
Use RPOP authentication (similar to UNIX r-commands) to log into POP3 server.
</dl>
<P>
<dl><dt><b><a name='l2h-2081'><tt class='method'>stat</tt></a></b> ()
<dd>
Get mailbox status. The result is a tuple of 2 integers:
<code>(<var>message count</var>, <var>mailbox size</var>)</code>.
</dl>
<P>
<dl><dt><b><a name='l2h-2082'><tt class='method'>list</tt></a></b> (<big>[</big><var>which</var><big>]</big>)
<dd>
Request message list, result is in the form
<code>(<var>response</var>, ['mesg_num octets', ...])</code>. If <var>which</var> is
set, it is the message to list.
</dl>
<P>
<dl><dt><b><a name='l2h-2083'><tt class='method'>retr</tt></a></b> (<var>which</var>)
<dd>
Retrieve whole message number <var>which</var>. Result is in form
<code>(<var>response</var>, ['line', ...], <var>octets</var>)</code>.
</dl>
<P>
<dl><dt><b><a name='l2h-2084'><tt class='method'>dele</tt></a></b> (<var>which</var>)
<dd>
Delete message number <var>which</var>.
</dl>
<P>
<dl><dt><b><a name='l2h-2085'><tt class='method'>rset</tt></a></b> ()
<dd>
Remove any deletion marks for the mailbox.
</dl>
<P>
<dl><dt><b><a name='l2h-2086'><tt class='method'>noop</tt></a></b> ()
<dd>
Do nothing. Might be used as a keep-alive.
</dl>
<P>
<dl><dt><b><a name='l2h-2087'><tt class='method'>quit</tt></a></b> ()
<dd>
Signoff: commit changes, unlock mailbox, drop connection.
</dl>
<P>
<dl><dt><b><a name='l2h-2088'><tt class='method'>top</tt></a></b> (<var>which, howmuch</var>)
<dd>
Retrieves the message header plus <var>howmuch</var> lines of the message
after the header of message number <var>which</var>. Result is in form
<code>(<var>response</var>, ['line', ...], <var>octets</var>)</code>.
</dl>
<P>
<dl><dt><b><a name='l2h-2089'><tt class='method'>uidl</tt></a></b> (<big>[</big><var>which</var><big>]</big>)
<dd>
Return message digest (unique id) list.
If <var>which</var> is specified, result contains the unique id for that
message in the form <code>'<var>response</var> <var>mesgnum</var> <var>uid</var></code>,
otherwise result is list <code>(<var>response</var>, ['mesgnum uid', ...],
<var>octets</var>)</code>.
</dl>
<P>
<DIV CLASS="navigation"><p><hr><table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td><A href="module-poplib.html" tppabs="http://www.python.org/doc/current/lib/module-poplib.html"><img src="previous.gif" tppabs="http://www.python.org/doc/current/icons/previous.gif" border="0" height="32"
alt="Previous Page" width="32"></A></td>
<td><A href="module-poplib.html" tppabs="http://www.python.org/doc/current/lib/module-poplib.html"><img src="up.gif" tppabs="http://www.python.org/doc/current/icons/up.gif" border="0" height="32"
alt="Up One Level" width="32"></A></td>
<td><A href="pop3-example.html" tppabs="http://www.python.org/doc/current/lib/pop3-example.html"><img src="next.gif" tppabs="http://www.python.org/doc/current/icons/next.gif" border="0" height="32"
alt="Next Page" width="32"></A></td>
<td align="center" width="100%">Python Library Reference</td>
<td><A href="contents.html" tppabs="http://www.python.org/doc/current/lib/contents.html"><img src="contents.gif" tppabs="http://www.python.org/doc/current/icons/contents.gif" border="0" height="32"
alt="Contents" width="32"></A></td>
<td><a href="modindex.html" tppabs="http://www.python.org/doc/current/lib/modindex.html" title="Module Index"><img src="modules.gif" tppabs="http://www.python.org/doc/current/icons/modules.gif" border="0" height="32"
alt="Module Index" width="32"></a></td>
<td><A href="genindex.html" tppabs="http://www.python.org/doc/current/lib/genindex.html"><img src="index.gif" tppabs="http://www.python.org/doc/current/icons/index.gif" border="0" height="32"
alt="Index" width="32"></A></td>
</tr></table>
<b class="navlabel">Previous:</b> <a class="sectref" href="module-poplib.html" tppabs="http://www.python.org/doc/current/lib/module-poplib.html">11.7 poplib </A>
<b class="navlabel">Up:</b> <a class="sectref" href="module-poplib.html" tppabs="http://www.python.org/doc/current/lib/module-poplib.html">11.7 poplib </A>
<b class="navlabel">Next:</b> <a class="sectref" href="pop3-example.html" tppabs="http://www.python.org/doc/current/lib/pop3-example.html">11.7.2 POP3 Example</A>
</DIV>
<!--End of Navigation Panel-->
<ADDRESS>
<hr>See <i><a href="about.html" tppabs="http://www.python.org/doc/current/lib/about.html">About this document...</a></i> for information on suggesting changes.
</ADDRESS>
</BODY>
</HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -