I would like to interrogate all new emails (one by one) and find the contents of them so that I can use the contents for another application.
My first step was interpreting the return values from a search done via the search attr of an IMAP4 object. I’m trying to figure out what data is in a list that I have returned to me.
How can I examine the object tree via print? Or, better yet, how can I get the contents of the email in a string?
For ex., I am returned the following via print:
unseen email content: ['3 4'] from a variable named “response”.
If I run print response.__class__.__name__, I get “list” returned.
I know that there is other data in “3”, and “4”, I just don’t know what.
update: Specifically, this is the return of a call to an IMAP4obj.search(None, ‘(UNSEEN)’)
from the python docs (here) this example:
it seems a tuple is returned, you can try,
try reading the docs, see if it can help clarify your doubts or even make your question clearer.