开发者

Is it possible to check if an email contains an attachement just from the e-mail header?

开发者 https://www.devze.com 2023-01-15 05:25 出处:网络
I am developing an email client in Python. Is it possible to check if an email contains an attachement just from the e-mail hea开发者_运维百科der without downloading the whole E-Mail?Try IMAP4.fetch(

I am developing an email client in Python.

Is it possible to check if an email contains an attachement just from the e-mail hea开发者_运维百科der without downloading the whole E-Mail?


Try IMAP4.fetch(message_set, "BODYSTRUCTURE")

Read the RFC3501 for details about the FETCH BODYSTRUCTURE response.


"attachment" is quite a broad term. Is an image for HTML message an attachment?

In general, you can try analyzing content-type header. If it's multipart/mixed, most likely the message contains an attachment.

0

精彩评论

暂无评论...
验证码 换一张
取 消