searching imap mail folder but excluding one subfolder

Discussion in 'Python' started by Kevin F, Mar 23, 2006.

  1. Kevin F

    Kevin F Guest

    I have code that searches under the default folder (inbox) but I would
    like to modify it to search for everything in that folder with the
    exception of one subfolder where I would like it not to search.

    my current code is:


    from imaplib import *
    import getpass

    server = IMAP4("webmail.xxxxx.xxxx.edu")

    server.login('username', getpass.getpass())

    r = server.select("Inbox")

    r, data = server.search(None, 'SUBJECT', 'WALLET ENLARGEMENT')
    for num in data[0].split():
    server.store(num, '+FLAGS', '\\Deleted')
    server.expunge()


    how do i modify it so that, for example, it searches in inbox but does
    not search in a specific subfolder 'opim' under inbox?
     
    Kevin F, Mar 23, 2006
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Henrik Ormåsen

    Curier-IMAP and imap.create()

    Henrik Ormåsen, Aug 19, 2006, in forum: Ruby
    Replies:
    0
    Views:
    178
    Henrik Ormåsen
    Aug 19, 2006
  2. Jon Fi
    Replies:
    4
    Views:
    545
    Kashia Buch
    Oct 21, 2006
  3. jasonnaylor
    Replies:
    1
    Views:
    256
    jasonnaylor
    Apr 16, 2008
  4. Adam Akhtar
    Replies:
    1
    Views:
    179
    Eric Hodel
    Dec 15, 2008
  5. Abhishiv Saxena

    Support for IMAP IDLE in net/imap

    Abhishiv Saxena, Jul 3, 2009, in forum: Ruby
    Replies:
    4
    Views:
    198
    Eric Hodel
    Jul 4, 2009
Loading...

Share This Page