| 1 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
| 2 | <html> |
| 3 | <head> |
| 4 | <link rel="STYLESHEET" href="lib.css" type='text/css' /> |
| 5 | <link rel="SHORTCUT ICON" href="../icons/pyfav.png" type="image/png" /> |
| 6 | <link rel='start' href='../index.html' title='Python Documentation Index' /> |
| 7 | <link rel="first" href="lib.html" title='Python Library Reference' /> |
| 8 | <link rel='contents' href='contents.html' title="Contents" /> |
| 9 | <link rel='index' href='genindex.html' title='Index' /> |
| 10 | <link rel='last' href='about.html' title='About this document...' /> |
| 11 | <link rel='help' href='about.html' title='About this document...' /> |
| 12 | <link rel="next" href="module-imaplib.html" /> |
| 13 | <link rel="prev" href="module-gopherlib.html" /> |
| 14 | <link rel="parent" href="internet.html" /> |
| 15 | <link rel="next" href="pop3-objects.html" /> |
| 16 | <meta name='aesop' content='information' /> |
| 17 | <title>11.9 poplib -- POP3 protocol client</title> |
| 18 | </head> |
| 19 | <body> |
| 20 | <DIV CLASS="navigation"> |
| 21 | <div id='top-navigation-panel' xml:id='top-navigation-panel'> |
| 22 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> |
| 23 | <tr> |
| 24 | <td class='online-navigation'><a rel="prev" title="11.8 gopherlib " |
| 25 | href="module-gopherlib.html"><img src='../icons/previous.png' |
| 26 | border='0' height='32' alt='Previous Page' width='32' /></A></td> |
| 27 | <td class='online-navigation'><a rel="parent" title="11. Internet Protocols and" |
| 28 | href="internet.html"><img src='../icons/up.png' |
| 29 | border='0' height='32' alt='Up One Level' width='32' /></A></td> |
| 30 | <td class='online-navigation'><a rel="next" title="11.9.1 POP3 Objects" |
| 31 | href="pop3-objects.html"><img src='../icons/next.png' |
| 32 | border='0' height='32' alt='Next Page' width='32' /></A></td> |
| 33 | <td align="center" width="100%">Python Library Reference</td> |
| 34 | <td class='online-navigation'><a rel="contents" title="Table of Contents" |
| 35 | href="contents.html"><img src='../icons/contents.png' |
| 36 | border='0' height='32' alt='Contents' width='32' /></A></td> |
| 37 | <td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png' |
| 38 | border='0' height='32' alt='Module Index' width='32' /></a></td> |
| 39 | <td class='online-navigation'><a rel="index" title="Index" |
| 40 | href="genindex.html"><img src='../icons/index.png' |
| 41 | border='0' height='32' alt='Index' width='32' /></A></td> |
| 42 | </tr></table> |
| 43 | <div class='online-navigation'> |
| 44 | <b class="navlabel">Previous:</b> |
| 45 | <a class="sectref" rel="prev" href="module-gopherlib.html">11.8 gopherlib </A> |
| 46 | <b class="navlabel">Up:</b> |
| 47 | <a class="sectref" rel="parent" href="internet.html">11. Internet Protocols and</A> |
| 48 | <b class="navlabel">Next:</b> |
| 49 | <a class="sectref" rel="next" href="pop3-objects.html">11.9.1 POP3 Objects</A> |
| 50 | </div> |
| 51 | <hr /></div> |
| 52 | </DIV> |
| 53 | <!--End of Navigation Panel--> |
| 54 | |
| 55 | <H1><A NAME="SECTION0013900000000000000000"> |
| 56 | 11.9 <tt class="module">poplib</tt> -- |
| 57 | POP3 protocol client</A> |
| 58 | </H1> |
| 59 | |
| 60 | <P> |
| 61 | <A NAME="module-poplib"></A> |
| 62 | |
| 63 | <P> |
| 64 | <a id='l2h-3372' xml:id='l2h-3372'></a> |
| 65 | <P> |
| 66 | This module defines a class, <tt class="class">POP3</tt>, which encapsulates a |
| 67 | connection to a POP3 server and implements the protocol as defined in |
| 68 | <a class="rfc" id='rfcref-90170' xml:id='rfcref-90170' |
| 69 | href="http://www.faqs.org/rfcs/rfc1725.html">RFC 1725</a>. The <tt class="class">POP3</tt> class supports both the minimal and |
| 70 | optional command sets. Additionally, this module provides a class |
| 71 | <tt class="class">POP3_SSL</tt>, which provides support for connecting to POP3 |
| 72 | servers that use SSL as an underlying protocol layer. |
| 73 | |
| 74 | <P> |
| 75 | Note that POP3, though widely supported, is obsolescent. The |
| 76 | implementation quality of POP3 servers varies widely, and too many are |
| 77 | quite poor. If your mailserver supports IMAP, you would be better off |
| 78 | using the <code><tt class="module"><a href="module-imaplib.html">imaplib</a></tt>.<tt class="class">IMAP4</tt></code> class, as IMAP |
| 79 | servers tend to be better implemented. |
| 80 | |
| 81 | <P> |
| 82 | A single class is provided by the <tt class="module">poplib</tt> module: |
| 83 | |
| 84 | <P> |
| 85 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 86 | <td><nobr><b><span class="typelabel">class</span> <tt id='l2h-3373' xml:id='l2h-3373' class="class">POP3</tt></b>(</nobr></td> |
| 87 | <td><var>host</var><big>[</big><var>, port</var><big>]</big><var></var>)</td></tr></table></dt> |
| 88 | <dd> |
| 89 | This class implements the actual POP3 protocol. The connection is |
| 90 | created when the instance is initialized. |
| 91 | If <var>port</var> is omitted, the standard POP3 port (110) is used. |
| 92 | </dl> |
| 93 | |
| 94 | <P> |
| 95 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 96 | <td><nobr><b><span class="typelabel">class</span> <tt id='l2h-3374' xml:id='l2h-3374' class="class">POP3_SSL</tt></b>(</nobr></td> |
| 97 | <td><var>host</var><big>[</big><var>, port</var><big>[</big><var>, keyfile</var><big>[</big><var>, certfile</var><big>]</big><var></var><big>]</big><var></var><big>]</big><var></var>)</td></tr></table></dt> |
| 98 | <dd> |
| 99 | This is a subclass of <tt class="class">POP3</tt> that connects to the server over an |
| 100 | SSL encrypted socket. If <var>port</var> is not specified, 995, the |
| 101 | standard POP3-over-SSL port is used. <var>keyfile</var> and <var>certfile</var> |
| 102 | are also optional - they can contain a PEM formatted private key and |
| 103 | certificate chain file for the SSL connection. |
| 104 | |
| 105 | <P> |
| 106 | |
| 107 | <span class="versionnote">New in version 2.4.</span> |
| 108 | |
| 109 | </dl> |
| 110 | |
| 111 | <P> |
| 112 | One exception is defined as an attribute of the <tt class="module">poplib</tt> module: |
| 113 | |
| 114 | <P> |
| 115 | <dl><dt><b><span class="typelabel">exception</span> <tt id='l2h-3375' xml:id='l2h-3375' class="exception">error_proto</tt></b></dt> |
| 116 | <dd> |
| 117 | Exception raised on any errors. The reason for the exception is |
| 118 | passed to the constructor as a string. |
| 119 | </dd></dl> |
| 120 | |
| 121 | <P> |
| 122 | <div class="seealso"> |
| 123 | <p class="heading">See Also:</p> |
| 124 | |
| 125 | <dl compact="compact" class="seemodule"> |
| 126 | <dt>Module <b><tt class="module"><a href="module-imaplib.html">imaplib</a></tt>:</b> |
| 127 | <dd>The standard Python IMAP module. |
| 128 | </dl> |
| 129 | <dl compact="compact" class="seetitle"> |
| 130 | <dt><em class="citetitle"><a href="http://www.catb.org/~esr/fetchmail/fetchmail-FAQ.html" |
| 131 | >Frequently Asked Questions About Fetchmail</a></em></dt> |
| 132 | <dd>The FAQ for the <b class="program">fetchmail</b> POP/IMAP client collects |
| 133 | information on POP3 server variations and RFC noncompliance |
| 134 | that may be useful if you need to write an application based |
| 135 | on the POP protocol.</dd> |
| 136 | </dl> |
| 137 | </div> |
| 138 | |
| 139 | <P> |
| 140 | |
| 141 | <p><br /></p><hr class='online-navigation' /> |
| 142 | <div class='online-navigation'> |
| 143 | <!--Table of Child-Links--> |
| 144 | <A NAME="CHILD_LINKS"><STRONG>Subsections</STRONG></a> |
| 145 | |
| 146 | <UL CLASS="ChildLinks"> |
| 147 | <LI><A href="pop3-objects.html">11.9.1 POP3 Objects</a> |
| 148 | <LI><A href="pop3-example.html">11.9.2 POP3 Example</a> |
| 149 | </ul> |
| 150 | <!--End of Table of Child-Links--> |
| 151 | </div> |
| 152 | |
| 153 | <DIV CLASS="navigation"> |
| 154 | <div class='online-navigation'> |
| 155 | <p></p><hr /> |
| 156 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> |
| 157 | <tr> |
| 158 | <td class='online-navigation'><a rel="prev" title="11.8 gopherlib " |
| 159 | href="module-gopherlib.html"><img src='../icons/previous.png' |
| 160 | border='0' height='32' alt='Previous Page' width='32' /></A></td> |
| 161 | <td class='online-navigation'><a rel="parent" title="11. Internet Protocols and" |
| 162 | href="internet.html"><img src='../icons/up.png' |
| 163 | border='0' height='32' alt='Up One Level' width='32' /></A></td> |
| 164 | <td class='online-navigation'><a rel="next" title="11.9.1 POP3 Objects" |
| 165 | href="pop3-objects.html"><img src='../icons/next.png' |
| 166 | border='0' height='32' alt='Next Page' width='32' /></A></td> |
| 167 | <td align="center" width="100%">Python Library Reference</td> |
| 168 | <td class='online-navigation'><a rel="contents" title="Table of Contents" |
| 169 | href="contents.html"><img src='../icons/contents.png' |
| 170 | border='0' height='32' alt='Contents' width='32' /></A></td> |
| 171 | <td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png' |
| 172 | border='0' height='32' alt='Module Index' width='32' /></a></td> |
| 173 | <td class='online-navigation'><a rel="index" title="Index" |
| 174 | href="genindex.html"><img src='../icons/index.png' |
| 175 | border='0' height='32' alt='Index' width='32' /></A></td> |
| 176 | </tr></table> |
| 177 | <div class='online-navigation'> |
| 178 | <b class="navlabel">Previous:</b> |
| 179 | <a class="sectref" rel="prev" href="module-gopherlib.html">11.8 gopherlib </A> |
| 180 | <b class="navlabel">Up:</b> |
| 181 | <a class="sectref" rel="parent" href="internet.html">11. Internet Protocols and</A> |
| 182 | <b class="navlabel">Next:</b> |
| 183 | <a class="sectref" rel="next" href="pop3-objects.html">11.9.1 POP3 Objects</A> |
| 184 | </div> |
| 185 | </div> |
| 186 | <hr /> |
| 187 | <span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span> |
| 188 | </DIV> |
| 189 | <!--End of Navigation Panel--> |
| 190 | <ADDRESS> |
| 191 | See <i><a href="about.html">About this document...</a></i> for information on suggesting changes. |
| 192 | </ADDRESS> |
| 193 | </BODY> |
| 194 | </HTML> |