Question

I am trying to read e-mails in a Lotus Notes database via python and com. (using pythonwin and win32com)

I can connect to the database and read NotesDocument items but

doc = folder.GetFirstDocument()
doc.GetItemValue('Body')

returns the plain text contents of the email. I can get the headers, subject, date, etc but body is plaintext. I'm trying to fetch the HTML source of the email which includes links and other formatting. I know the stuff is there because within Notes I can view-->show--> page source.

I've tried

doc.GetMIMEEntity('Body')

but this returns None.

Was it helpful?

Solution

Try adding this line right after where you get the session:

session.ConvertMIME = False

Update:

Barry commented that it worked this way:

doc.GetFirstItem("Body").GetMIMEEntity()

OTHER TIPS

The body is a rich text item. You won't be able to access the HTML version of the body field, but you can navigate around the rich text item using the NotesRichText... classes.

The NotesRichTextNavigator class has an example to get you started. It is unfortunately not very easy to get around in that object.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top