seanh
seanh

Reputation: 97

Python Imaplib search multiple SUBJECT criteria and special characters

I have trouble using impalib to search email that contain more than two subjects, for example: import imaplib m = imaplib.IMAP4_SSL("imap.gmail.com") m.login('myname', 'mypwd') m.select("Inbox") resp, items = m.uid('search', None, "(SUBJECT baseball SUBJECT basketball)") will have no problem getting data from searching those subject. However, if i search more than two subjects resp, items = m.uid('search', None, "(SUBJECT baseball SUBJECT basketball SUBJECT football)") it won't have data come back. also, subject like ""space jam" or "matchbox 20" will have trouble of parsing in the field

Upvotes: 2

Views: 3590

Answers (1)

00theway
00theway

Reputation: 31

you can search like this.

m.uid('search', None, "(OR (SUBJECT baseball) (SUBJECT basketball))")

Upvotes: 3

Related Questions