I'm getting email in outlook with python.In my Notebook with Outlook version = 2016.Code's work well.This's my output in Notebook.
But when I get code to another PC with Outlook version = 2010.Code doesn't run and error "AttributeError: 'NoneType' object has no attribute 'body' Like this :
This's my Code:
import win32com.client
outlook = win32com.client.Dispatch("Outlook.Application").GetNamespace("MAPI")
inbox = outlook.GetDefaultFolder(6)
messages = inbox.Items
message = messages.GetLast()
body_content = message.Body
subject = message.Subject
sender = message.Recipients
categories = message.Categories
Please recommended me how to fix this problem.