Python Forum

Full Version: Unable to fetch Outlook Mail body
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi All,

This is my second post.So here is issue.

I have a script code where fetching the data from outlook. i am able to get [ReceivedTime,EntryID].
But i am unable to get HTMLBody data. I do not know where is the problem is coming. Plz help me out this problem.
I am showing my code as well as error which i am getting.


]import win32com.client, sqlite3
from datetime import datetime

outlook = win32com.client.Dispatch("Outlook.Application").GetNamespace("MAPI")
inbox = outlook.GetDefaultFolder(6)
messages = inbox.Items
for  message in messages:
    print(message.HTMLBody)
Error:
Traceback (most recent call last): File "C:/C drive/Python/test.py", line 9, in <module> print(message.HTMLBody) File "C:\Users\pramod.singh\AppData\Roaming\Python\Python36\site-packages\win32\com\client\dynamic.py", line 577, in __getattr__ ret = self._oleobj_.Invoke(retEntry.dispid, 0, invoke_type, 1) win32.types.com_error: (-2147467260, 'Operation aborted', None, None)