Yurttas/PL/SL/python/docs/core-python-programming/doc/152/lib/pop3-example.html

From ZCubes Wiki
Revision as of 18:41, 7 November 2013 by MassBot1 (talk | contribs) (Created page with "<div class="navigation"> {| width="100%" cellspacing="2" align="center" | yurttas/PL/SL/python/docs/core-python-programming/doc/152/lib/module-imaplib.html|[[Image:yurt...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search


11.6.2 POP3 Example

Here is a minimal example (without error checking) that opens a mailbox and retrieves and prints all messages:

import getpass, poplib

M = poplib.POP3('localhost')
M.user(getpass.getuser())
M.pass_(getpass.getpass())
numMessages = len(M.list()[1])
for i in range(numMessages):
    for j in M.retr(i+1)[1]:
        print j

At the end of the module, there is a test section that contains a more extensive example of usage.


Send comments on this document to python-docs@python.org.