#!/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: typ, data = c.select('INBOX') print typ, data num_msgs = int(data[0]) print 'There are %d messages in INBOX' % num_msgs finally: c.close() c.logout()