Quantcast
Channel: Active questions tagged email - Stack Overflow
Viewing all articles
Browse latest Browse all 29748

NoneType object has no attribute "Body" error with python E-mailing

$
0
0

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. 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 : PC code doesn't run and error "AttributeError: 'NoneType' object has no attribute 'body'

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.


Viewing all articles
Browse latest Browse all 29748

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>