Python outlook msg对象中的所有变量是什么

Python outlook msg对象中的所有变量是什么,python,outlook,Python,Outlook,使用此代码,我将收到收件箱中的电子邮件: outlook = win32com.client.Dispatch('Outlook.Application').GetNamespace('MAPI') namespace = outlook.Session recipient = namespace.CreateRecipient("someshareemail@email.com") inbox = outlook.GetSharedDefaultFolder(recipient, 6) mes

使用此代码,我将收到收件箱中的电子邮件:

outlook = win32com.client.Dispatch('Outlook.Application').GetNamespace('MAPI')
namespace = outlook.Session
recipient = namespace.CreateRecipient("someshareemail@email.com")
inbox = outlook.GetSharedDefaultFolder(recipient, 6)
messages = inbox.Items
for message in messages:
    print message.SenderName
    print message.SenderEmailAddress
我想知道,有没有办法获得发送者的IP

我尝试使用dir()查找对象的属性,但没有找到:

['_ApplyTypes_', '_FlagAsMethod', '_LazyAddAttr_', '_NewEnum', '_Release_', '__AttrToID__', '__LazyMap__', '__call__', '__doc__', '__eq__', '__getattr__', '__getitem__', '__init__', '__int__', '__len__', '__module__', '__ne__', '__nonzero__', '__repr__', '__setattr__', '__setitem__', '__str__', '_builtMethods_', '_enum_', '_find_dispatch_type_', '_get_good_object_', '_get_good_single_object_', '_lazydata_', '_make_method_', '_mapCachedItems_', '_oleobj_', '_olerepr_', '_print_details_', '_proc_', '_unicode_to_string_', '_username_', '_wrap_dispatch_']

您可以使用MailItem.PropertyAccessor读取PR_TRANSPORT_MESSAGE_HEADERS_W属性的值。查找X-origing-IP头,如果它存在,应该包含发送者的IP地址。

尝试
dir(message)
并找出答案@jonrsharpe我一开始尝试了这个方法,得到了一些奇怪的值:'(编辑问题以反映结果那么是message.PropertyAccessor吗?因为无论出于什么原因,这只是打印出电子邮件的正文。
message.PropertyAccessor.GetProperty(“http://schemas.microsoft.com/mapi/proptag/0x007D001F")
应该做这项工作,@DmitryStreblechenko啊!这项工作做得很好,但我不知道背景中到底发生了什么,你能详细说明一下吗?