mbox and maildir check for new mail

Posted on 2004-11-07
Medium Priority
Last Modified: 2012-06-27
how can i with python check mbox's and maildir's for new mail?
I'm just looking after how mbox and maildir says that a mail is read or not,
i don't need any code.
Question by:hegga

Accepted Solution

mces earned 750 total points
ID: 12521672
A mail that is read, has in it's Status header a letter R.  So, for example the following mail is not read yet:

From:   Siamak
To:     "Behdad Esfahbod" <behdad>
Subject: "Eat The Document" in Toronto
Date:   Sun, 31 Oct 2004 21:29:43 -0500
Status: O

But this one is the same message, but read this time:

From:   Siamak
To:     "Behdad Esfahbod" <behdad>
Subject: "Eat The Document" in Toronto
Date:   Sun, 31 Oct 2004 21:29:43 -0500
Status: RO

Other flags may come and go in Status, but "R" is for read.  This is for mbox, but I believe the same method is used for maindir too.

Hope it helps.

Expert Comment

ID: 12541121
In case of Maildir, you can simply look into Maildir/new folder to see if there are any e-mail files here.
Each file represents one new e-mail.
Each e-mail is moved to Maildir/cur folder automatically when it's in status Read so you don't have to worry aboit it.

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Plenty of writing has gone on the web trying to compare Python with other competitive programming languages and vice versa. However, not much has been put into a wholistic perspective. This article should help you decide whether to adopt Python as a…
Variable is a place holder or reserved memory locations to store any value. Which means whenever we create a variable, indirectly we are reserving some space in the memory. The interpreter assigns or allocates some space in the memory based on the d…
Learn the basics of strings in Python: declaration, operations, indices, and slicing. Strings are declared with quotations; for example: s = "string": Strings are immutable.: Strings may be concatenated or multiplied using the addition and multiplic…
Learn the basics of lists in Python. Lists, as their name suggests, are a means for ordering and storing values. : Lists are declared using brackets; for example: t = [1, 2, 3]: Lists may contain a mix of data types; for example: t = ['string', 1, T…
Suggested Courses
Course of the Month15 days, 16 hours left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question