- 帖子
- 2
- 精华
- 0
- 积分
- 11
- 阅读权限
- 10
- 注册时间
- 2021-3-22
- 最后登录
- 2021-3-24
|
from imbox import Imbox
import keyring as ke
sender = '2110158540@qq.com'
password = ke.get_password('yagmail', sender)
with Imbox('smtp.qq.com', sender, password) as imbox:
all_msg = imbox.messages(unread=True)
for uid, message in all_msg: # 遍历邮件
print(message.attachments)
print('uid', uid)
print('主题', message.subject)
# print('文本格式', message.body['plain'])
print('发件人:', message.sent_from)
print('收件人:', message.sent_to)
print('时间:', message.date)
print('成功')
#以下是报错
Traceback (most recent call last):
File "C:/Users/huangyong/PycharmProjects/pythonProject/模块功能/2.py", line 6, in <module>
with Imbox('smtp.qq.com', sender, password) as imbox:
File "D:\Anaconda\lib\site-packages\imbox\imbox.py", line 35, in __init__
self.connection = self.server.connect(username, password)
File "D:\Anaconda\lib\site-packages\imbox\imap.py", line 33, in connect
self.server.login(username, password)
File "D:\Anaconda\lib\imaplib.py", line 601, in login
typ, dat = self._simple_command('LOGIN', user, self._quote(password))
File "D:\Anaconda\lib\imaplib.py", line 1197, in _quote
arg = arg.replace('\\', '\\\\')
AttributeError: 'NoneType' object has no attribute 'replace'
进程已结束,退出代码为 1
|
|