0

I'm trying to get certain emails with HEADER values.

When I try with a Subject HEADER, it works properly.

res, tmp = self.mail.uid('search', None, 'HEADER Subject "Some Subject"')   

But when I try with a Date HEADER, it returns an empty list.

res, tmp = self.mail.uid('search', None, 'HEADER Date "Wed, 29 Apr 2020 19:00:22 +0900 (KST)"')

Those HEADER value strings are just copied from message['Subject'] and message['Date'].

When I print the code below:

print(message['Date'] == 'Wed, 29 Apr 2020 19:00:22 +0900 (KST)')   

"True" is printed.

What could be wrong in my code?

yoon
  • 1,177
  • 2
  • 15
  • 28
  • It could be just your server doesn’t do that. Perhaps it doesn’t index date headers. Not every server implementation has the same quality of search, and some searches would be extremely slow on large servers if not indexed, and searching for an exact Date header is somewhat unusual so it might not be indexed. – Max Apr 29 '20 at 14:52
  • @Max Thanks for your comment, but what do you mean 'it doesn't index date headers'? When I print email.message instance that is received from the server, it shows date values. What's the difference between having a Date header and indexing Date header? If it's about server thing, what can I don with this? – yoon May 01 '20 at 06:05

0 Answers0