我正在使用this库阅读python中的gmail收件箱。这是我收到的每封邮件的回复:
From nobody Mon Dec 26 16:42:46 2016
Delivered-To: someone@examplemail.com
Received: by 10.28.211.66 with SMTP id ferf98er9fef9fr;
.
.
.
X-Source-Dir: erferfefefrref:/public_html
X-CMAE-Envelope: grtgrtgrtgrtgrt......
This is the message body
在检查响应的对象类型时,它返回<type 'instance'>
我可以使用此代码读取Subject, Delivered-To, Received, X-Source-Dir
之类的属性
print response['subject']
print response['delivered-to']
但无法读取消息体(在给定示例中为This is the message body
)
图书馆的文件说我们可以用
print response.body
但这似乎不起作用,反而产生了这个错误:
Message instance has no attribute 'body'
有没有其他方法可以从上面的数据中提取尸体??你知道吗
从您在问题中链接的页面:
这对你不管用吗?你知道吗
相关问题 更多 >
编程相关推荐