I am trying to read and save the most recent email attachments with specific email subject. I know how to filter the email by the subject line OR the receive time. But I don't know how to combine this two requests. Can you please let me know if you have a better idea to resolve this?
I only know how to read the most recent email using this
for item in a.inbox.children:
for e in item.all().order_by('-datetime_received')[:1]:
for attachment in e.attachments:
...
I know how to get the specific subject email:
for item in a.inbox.children.filter(subject = 'this is my subject line'):
for attachment in item.attachments:
....
How could I obtain the most recent email attachment from a specific subject line?
Thanks a lot!