(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
|
[[yurttas/PL/SL/python/docs/core-python-programming/doc/152/lib/module-nntplib.html| ]]
|
[[yurttas/PL/SL/python/docs/core-python-programming/doc/152/lib/module-imaplib.html| ]]
|
[[yurttas/PL/SL/python/docs/core-python-programming/doc/152/lib/imap4-objects.html| ]]
|
Python Library Reference
|
[[yurttas/PL/SL/python/docs/core-python-programming/doc/152/lib/contents.html| ]]
|
[[yurttas/PL/SL/python/docs/core-python-programming/doc/152/lib/modindex.html| ]]
|
[[yurttas/PL/SL/python/docs/core-python-programming/doc/152/lib/genindex.html| ]]
|
Next: 11.8 nntplib Up: 11.7 imaplib Previous: 11.7.1 IMAP4 Objects
11.7.2 IMAP4 Example
Here is a minimal example (without error checking) that opens a mailbox and retrieves and prints all messages:
import getpass, imaplib, string
M = imaplib.IMAP4()
M.login(getpass.getuser(), getpass.getpass())
M.select()
typ, data = M.search(None, 'ALL')
for num in string.split(data[0]):
typ, data = M.fetch(num, '(RFC822)')
print 'Message %s\n%s\n' % (num, data[0][1])
M.logout()
|
[[yurttas/PL/SL/python/docs/core-python-programming/doc/152/lib/module-nntplib.html| ]]
|
[[yurttas/PL/SL/python/docs/core-python-programming/doc/152/lib/module-imaplib.html| ]]
|
[[yurttas/PL/SL/python/docs/core-python-programming/doc/152/lib/imap4-objects.html| ]]
|
Python Library Reference
|
[[yurttas/PL/SL/python/docs/core-python-programming/doc/152/lib/contents.html| ]]
|
[[yurttas/PL/SL/python/docs/core-python-programming/doc/152/lib/modindex.html| ]]
|
[[yurttas/PL/SL/python/docs/core-python-programming/doc/152/lib/genindex.html| ]]
|
Next: 11.8 nntplib Up: 11.7 imaplib Previous: 11.7.1 IMAP4 Objects
Send comments on this document to python-docs@python.org.