【发布时间】:2018-02-23 13:10:52
【问题描述】:
我正在尝试获取在我的 gmail 上发送的确切文本,但我也获得了其他值,以下是我的代码。
import imaplib
server = imaplib.IMAP4_SSL ('imap.gmail.com', 993)
username = 'email'
password = 'pass'
server.login(username, password)
stat , content = server.select('Inbox')
stat , data = server.fetch(content[0],'(UID BODY[TEXT])')
print (data[0][1].decode())
server.close()
server.logout()
在这种情况下,我的输出是
--001a11443f6015ac310559254049
Content-Type: text/plain; charset="UTF-8"
hello
--001a11443f6015ac310559254049
Content-Type: text/html; charset="UTF-8"
<div dir="auto">hello</div>
--001a11443f6015ac310559254049--
但我的信息只是你好
【问题讨论】:
标签: python python-3.x imaplib