0

I am using imaplib module to connect to outlook account which used for webdriver tests (our application sends emails). Letter contains screenshot and some text.

I am searching inbox following way: self._imap.search(None, 'UNDELETED', 'UNSEEN', '(TEXT "__some_random_string")'). Of course, it already connected and logged in. Today I faced strange issue that letter found by __some_random_strin or by __some_random but is not found by full string. If I opening message in web interface of Outlook then mark it as unread back IMAP search operation completed successfully.

It seems for me that IMAP initially only searches by first N bytes of message or something like that, but I cannot find any mentions about that. Maybe it is feature of IMAP implementation of Outlook.com?

UPD: If I am searching using following citeria: self._imap.search(None, 'UNDELETED', 'UNSEEN') or self._imap.search(None, 'UNSEEN') or self._imap.search(None, 'UNDELETED') desired message is found successfully.

Alex G.P.
  • 9,609
  • 6
  • 46
  • 81
  • Is this not maybe caused by the `UNSEEN` search filter you've applied? – mfitzp Jan 15 '16 at 15:35
  • @mfitzp I don't think so - initially message has state "UNSEEN" when it is arrives, isn't it? – Alex G.P. Jan 15 '16 at 15:39
  • That's right but you say "I opening message in web interface of Outlook then mark it as unread back IMAP search operation completed successfully" ...so marking it unread (`UNSEEN`) makes it findable again, correct? – mfitzp Jan 15 '16 at 15:44
  • @mfitzp looks like that. – Alex G.P. Jan 15 '16 at 15:44
  • But your search `self._imap.search(None, 'UNDELETED', 'UNSEEN', '(TEXT "__some_random_string")')` is filtering *only* on `UNSEEN` messages. If you remove the `UNSEEN` filter in that search you will see the message, no? – mfitzp Jan 15 '16 at 15:46
  • No. If I searching (without opening message in web interface) by `'UNDELETED' 'UNSEEN'` i.e. without string pattern this message found successfully. – Alex G.P. Jan 15 '16 at 15:49
  • Oh, that is strange. Can you edit question to clarify that a bit? I wonder if this is a search string length limit? i.e. what is the effect of removing `UNDELETED`? Can't find any reference to a limit existing however. – mfitzp Jan 15 '16 at 16:02
  • Updated with my actions. – Alex G.P. Jan 15 '16 at 16:47

0 Answers0