This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: imaplib search() quoting search criteria
Type: Stage:
Components: Library (Lib) Versions:
process
Status: closed Resolution: works for me
Dependencies: Superseder:
Assigned To: skip.montanaro Nosy List: b7kich, skip.montanaro, tim.peters
Priority: normal Keywords:

Created on 2001-03-07 15:05 by b7kich, last changed 2022-04-10 16:03 by admin. This issue is now closed.

Messages (4)
msg3768 - (view) Author: Christian Kissner (b7kich) Date: 2001-03-07 15:05
Imaplib IMAP4.search() contains a bug in criteria
handling: when
sending a single word criterium it gets written to the
stream well: 
	M.search(None, 'ALL')
produces:
	GINH16 SEARCH
ALL                                         

But a criterium with a white space will be quoted:

	M.search(None,'TEXT Hello')
produces in the tcp stream:
	GINH17 SEARCH "TEXT Hello"

which gets rejected because quotes are only allowed
around
the string, not the criterium:
	GINH17 SEARCH TEXT "Hello"

msg3769 - (view) Author: Tim Peters (tim.peters) * (Python committer) Date: 2001-03-18 05:49
Logged In: YES 
user_id=31435

Assigned to Skip at random.
msg3770 - (view) Author: Skip Montanaro (skip.montanaro) * (Python triager) Date: 2001-03-18 20:01
Logged In: YES 
user_id=44345

This doesn't look like a bug to me.  Looks like the search
call is incorrect.  I think it should be called as

    M.search(None, "TEXT", "Hello")

I've never used the imaplib stuff before, however.  I'd
welcome some input from someone who has.

Skip
msg3771 - (view) Author: Skip Montanaro (skip.montanaro) * (Python triager) Date: 2001-03-20 21:34
Logged In: YES 
user_id=44345

Having heard nothing else on this, I'm going to conclude my
reading of the code was correct and am closing it
History
Date User Action Args
2022-04-10 16:03:50adminsetgithub: 34114
2001-03-07 15:05:05b7kichcreate