IMAP4.search by message-id ?

Tony Meyer t-meyer at ihug.co.nz
Thu Mar 31 04:02:05 CEST 2005


> 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
"<20040929030919.78882.qmail at web20025.mail.yahoo.com>")')
('OK', ['4'])
>>> i.logout()
[...]

=Tony.Meyer




More information about the Python-list mailing list