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