I am trying to read some info from a bunch of emails quickly without pulling the whole object and set the mail item as read. Especially so, since most of the emails have large attachments I do not want to pull them. For this I try something as follows:
mail_filter = acct.inbox.filter(message_id__in=email_id_list).values_list("subject", "body", "datetime_received", "sender")
mail_filter.page_size = 2
for item in mail_filter.iterator():
do_something_with_the_tuple_in_item()
# Now I want to set is_read = True. Something like below:
acct.inbox.filter(message_id__in=email_id_list).update(is_read=True)
While with values_list I could avoid getting the whole mail item (which otherwise seems to consume lots of memory especially for emails with attachments), I find there is no update() support on the filter. So in order for me to set an email to be is_read, I meed to pull the object (at the cost of memory) and set is_read = True, then save() back. Basically, it fails the purpose to save memory usage by using values_list. Any other idea exists? Anything I am missing?