Counting Messages in IMAP Folders in Python

Continuing on my last post (), I wanted to show a snippet of Python code that will list a set of IMAP folders and count the number of messages in them. You give it a starting folder and it lists that folder plus all/any sub-folders and their message counts. At the very end it prints a total message count.

Listing IMAP Mailboxes with Python

I’ve been working on some Python scripts recently to manage my IMAP mailboxes and the information I found on the internet was fairly good, but lacked a completeness that my newbie Python skills required. So, I figured I’d post a complete example to list mailboxes (folders) for your IMAP account. This was developed using Python 3.3.

I hope this code snippet help you on your way to Python IMAP goodness. If not, it will at least server as a reminder to myself the next time I need to do something like this. – Easy File Sharing On The Go

Ever have a really big file that you need to share or send to someone? Isn’t it frustrating when your email server, or their email server, or your email software or something in between won’t allow you to send the file? Yes, I have had this frustration before as well.

Now you can just go to and send your file in three easy steps!

  1. Select your file and give a brief description. The file will be uploaded to the server.
  2. Fill in email addresses to send the file to, a personal message and your own email address (optional).
  3. Click send!

That’s right, it is all on the initial page that you land on and there is no registration required. The file is uploaded to their server where they will host it for one month, after which it will be deleted. A link to the file will be sent to the email addresses that you specify and the recipients can retrieve the file at their leisure. The only downside that I found was that they only support files 100mb or smaller.