IMAP4.search by message-id ?

2005-03-29 Thread Sean Dodsworth
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

Any ideas?


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: IMAP4.search by message-id ?

2005-03-30 Thread Sean Dodsworth
Max M wrote:

> Sean Dodsworth 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
> 
> 
> Why do you need the 'HEADER'
> 
> Wouldn't this be enough?
> 
> resp, items = server.search(None, 'Message-id', msgID)
> 
> I am note shure if the msgId should be quoted. I assume not, as it will
> allways be an integer.
> 

Max,
Thanks, but it didnt work.
I still get the same error:
error: SEARCH command error: BAD ['Bogus criteria list in SEARCH']
args = ("SEARCH command error: BAD ['Bogus criteria list in SEARCH']",)

I had originally included the HEADER field as per the RFC3501 documentation:
HEADER  

also, the message-id is not an integer its a string like:
<[EMAIL PROTECTED]>

-- 
http://mail.python.org/mailman/listinfo/python-list


RE: IMAP4.search by message-id ?

2005-03-31 Thread Sean Dodsworth
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
> "<[EMAIL PROTECTED]>")')
> ('OK', ['4'])
 i.logout()
> [...]
> 
> =Tony.Meyer

Thank Tony...works fine now
-- 
http://mail.python.org/mailman/listinfo/python-list