#!/usr/bin/python
#
# $Id: imap_dups.py,v 1.1 2000/08/23 16:29:16 connolly Exp $
#
# Network Working Group                                        M. Crispin
# Request for Comments: 2060                     University of Washington
# Obsoletes: 1730                                           December 1996
# Category: Standards Track
#
#            INTERNET MESSAGE ACCESS PROTOCOL - VERSION 4rev1
# http://www.isi.edu/in-notes/rfc2060.txt

# Why UID? why not just use Message-ID?
# "registered" charset: registered as of when? as of the writing
# of RFC2060? as of the server implementation?
#
# concurrent access semantics: recent. goofy?

# Python Library Reference
#
#                             Guido van Rossum
#
#                   Corporation for National Research Initiatives (CNRI) 
#                   1895 Preston White Drive, Reston, Va 20191, USA 
#                 E-mail: guido@CNRI.Reston.Va.US, guido@python.org 
#
#                                  February 19, 1999
#                                    Release 1.5.2
#http://www.python.org/doc/lib/module-imaplib.html

import getpass, imaplib, string

imaplib.Debug = 5

M = imaplib.IMAP4()
M.LOGIN(getpass.getuser(), getpass.getpass())
M.SELECT('nsmail/000inbox', readonly=1)
typ, data = M.SEARCH(None, 'ALL')
for num in string.split(data[0]):
    typ, data = M.fetch(num, '(ENVELOPE)')
    print data[0]
M.LOGOUT()
