[英]imap_tools - Download attachments in python
i would like to download the attachments of a couple of emails.我想下载几封电子邮件的附件。 I got to store the attachment names in an list, but i don't really know what to do now.
我必须将附件名称存储在一个列表中,但我现在真的不知道该怎么做。 I want to download them and work with this files(xlsx) afterwards.
我想下载它们并在之后使用这些文件(xlsx)。 The names are stored in the list "atts".
名称存储在列表“atts”中。 This is the code it got so far:
这是到目前为止得到的代码:
mailbox.login(imap_user, imap_pass, initial_folder='INBOX')
y = 1
# Erstellung einer Liste, um die Namen der Anhänge zu speicern und auslesen zu können.
atts = []
for msg in mailbox.fetch('unseen', mark_seen=False):
for i in msg.attachments:
print(str(y) + ": " + i.filename)
y+=1
atts.append(i.filename)```
Repo has example dir回购有示例目录
https://github.com/ikvk/imap_tools/blob/master/examples/ https://github.com/ikvk/imap_tools/blob/master/examples/
Regards, imap_tools author.问候, imap_tools 作者。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.