【发布时间】:2021-08-07 13:41:30
【问题描述】:
我已经能够使用此代码选择 gmail 垃圾邮件文件夹和 Outlook 垃圾邮件文件夹
'[Gmail]/Spam' and 'Junk'
但我无法为 yahoomail 做同样的事情
下面是我的代码
smt = 'imap.mail.yahoo.com'
with MailBox(smt).login('******@yahoo.com', 'password', initial_folder='Inbox') as mailbox:
for f in mailbox.folder.list():
print(f)
下面是这段代码的结果
{'flags': ('\\Archive', '\\HasNoChildren'), 'delim': '/', 'name': 'Archive'}
{'flags': ('\\Junk', '\\HasNoChildren'), 'delim': '/', 'name': 'Bulk Mail'}
{'flags': ('\\Drafts', '\\HasNoChildren'), 'delim': '/', 'name': 'Draft'}
{'flags': ('\\HasNoChildren',), 'delim': '/', 'name': 'Inbox'}
{'flags': ('\\Sent', '\\HasNoChildren'), 'delim': '/', 'name': 'Sent'}
{'flags': ('\\Trash', '\\HasNoChildren'), 'delim': '/', 'name': 'Trash'}
我真的不知道如何选择垃圾邮件文件夹,我真的需要这个帮助。
【问题讨论】:
标签: python smtplib email-client