Python Forum
Unable to fetch Outlook Mail body - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Unable to fetch Outlook Mail body (/thread-11769.html)



Unable to fetch Outlook Mail body - pramodb35 - Jul-25-2018

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)