RE: IMAP4.search by message-id ?

Discussion in 'Python' started by Tony Meyer, Mar 31, 2005.

  1. Tony Meyer

    Tony Meyer Guest

    > Can anyone tell me how to get a message's number from the message-id
    > using IMAP4.search?
    > I've tried this:
    > resp, items = server.search(None, 'HEADER',
    > '"Message-id"', msgID) but it gives me a 'bogus search criteria' error


    >>> import imaplib
    >>> i = imaplib.IMAP4("mail.example.com")
    >>> i.login("username", "password")

    [...]
    >>> i.select()

    [...]
    >>> i.search(None, '(HEADER Message-ID

    "<>")')
    ('OK', ['4'])
    >>> i.logout()

    [...]

    =Tony.Meyer
    Tony Meyer, Mar 31, 2005
    #1
    1. Advertising

  2. Tony Meyer wrote:

    >> Can anyone tell me how to get a message's number from the message-id
    >> using IMAP4.search?
    >> I've tried this:
    >> resp, items = server.search(None, 'HEADER',
    >> '"Message-id"', msgID) but it gives me a 'bogus search criteria' error

    >
    >>>> import imaplib
    >>>> i = imaplib.IMAP4("mail.example.com")
    >>>> i.login("username", "password")

    > [...]
    >>>> i.select()

    > [...]
    >>>> i.search(None, '(HEADER Message-ID

    > "<>")')
    > ('OK', ['4'])
    >>>> i.logout()

    > [...]
    >
    > =Tony.Meyer


    Thank Tony...works fine now
    Sean Dodsworth, Mar 31, 2005
    #2
    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. Wilfredo Sanchez

    IMAP4 and deleting a message

    Wilfredo Sanchez, Dec 8, 2003, in forum: Python
    Replies:
    1
    Views:
    261
    Martin v. =?iso-8859-15?q?L=F6wis?=
    Dec 8, 2003
  2. Max M

    IMAP4.search by message-id ?

    Max M, Mar 30, 2005, in forum: Python
    Replies:
    2
    Views:
    379
    Sean Dodsworth
    Mar 30, 2005
  3. Luis Corrales

    IMAP4 search with special characters

    Luis Corrales, Jul 21, 2006, in forum: Python
    Replies:
    0
    Views:
    540
    Luis Corrales
    Jul 21, 2006
  4. Laszlo Nagy

    IMAP4 SEARCH question

    Laszlo Nagy, Dec 8, 2006, in forum: Python
    Replies:
    0
    Views:
    487
    Laszlo Nagy
    Dec 8, 2006
  5. Laszlo Nagy

    Re: IMAP4 SEARCH question

    Laszlo Nagy, Dec 8, 2006, in forum: Python
    Replies:
    0
    Views:
    384
    Laszlo Nagy
    Dec 8, 2006
Loading...

Share This Page