Counting the number of messages in an e-mail account with python
Question: is there any way, in Python, to have access to an e-mail account (I'll need
this for gmail but better if any works) and be able to see the number of
messages in the inbox (maybe even unread messages only)? Thank you.


Answer: **u Can Try This One**

import imaplib  
obj = imaplib.IMAP4_SSL('imap.gmail.com', 993)  
obj.login('username', 'password')  
obj.select('Inbox') <\-- it will return total number of mail in Inbox i.e
('OK', ['50'])  
obj.search(None,'UnSeen') <\-- it will return the list of uids for Unseen
mails

