Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在用 Python 开发一个电子邮件客户端。
是否可以在不下载整个电子邮件的情况下仅从电子邮件标题中检查电子邮件是否包含附件?
尝试IMAP4.fetch(message_set, "BODYSTRUCTURE")
IMAP4.fetch(message_set, "BODYSTRUCTURE")
有关 FETCH BODYSTRUCTURE 响应的详细信息,请阅读RFC3501。
“依恋”是一个相当宽泛的术语。HTML 消息的图像是附件吗?
一般来说,您可以尝试分析内容类型标头。如果它是multipart/mixed,则消息很可能包含附件。