Downloading multiple attachments using imaplib

后端 未结 6 982
星月不相逢
星月不相逢 2020-11-29 03:39

How can I download multiple attachments from a single mail using imaplib?

Let\'s say I have an e-mail and that e-mail contains 4 attachments. How can I download all

6条回答
  •  时光说笑
    2020-11-29 04:12

    You code appears okay except for the return (perhaps a typo?) right after the fp.close():

    ...
    fp.write(part.get_payload(decode=True))
    fp.close()
    return HttpResponse('check folder')
    

    After saving the first attachment it returns from the function. Comment out that line and see if it fixes your issue.

提交回复
热议问题