#!/usr/bin/env python # encoding: utf-8 # # Copyright (c) 2008 Doug Hellmann All rights reserved. # """ """ __version__ = "$Id$" #end_pymotw_header import imaplib import imaplib_connect c = imaplib_connect.open_connection() try: c.select('INBOX', readonly=True) print 'BODY:' typ, msg_data = c.fetch('1', '(BODY.PEEK[TEXT])') for response_part in msg_data: if isinstance(response_part, tuple): print response_part[1] finally: try: c.close() except: pass c.logout()