mbox and maildir check for new mail

Posted on 2004-11-07
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
    LVL 1

    Accepted Solution

    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.
    LVL 3

    Expert Comment

    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.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Here I am using Python IDLE(GUI) to write a simple program and save it, so that we can just execute it in future. Because when we write any program and exit from Python then program that we have written will be lost. So for not losing our program we…
    When we want to run, execute or repeat a statement multiple times, a loop is necessary. This article covers the two types of loops in Python: the while loop and the for loop.
    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…
    Learn the basics of if, else, and elif statements in Python 2.7. Use "if" statements to test a specified condition.: The structure of an if statement is as follows: (CODE) Use "else" statements to allow the execution of an alternative, if the …

    761 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

    Need Help in Real-Time?

    Connect with top rated Experts

    7 Experts available now in Live!

    Get 1:1 Help Now