开发者

Can you determine if an email has attachments from just the email header

开发者 https://www.devze.com 2023-01-05 22:16 出处:网络
Can you determine if an email has attachments from just the email header. If I call the Pop3 command \"TOP 1 0\" can I determine from the data returned if message has attachments.

Can you determine if an email has attachments from just the email header.

If I call the Pop3 command "TOP 1 0" can I determine from the data returned if message has attachments.

If not is there anyway of find this out with downloa开发者_C百科ding the whole message and counting the attachments.


POP3 does not provide attachment information in the header so no, unfortunately, I'm pretty sure you have to read and parse the entire message.

In any cases, not all POP3 servers provide the TOP command.


Does that command give you the full headers of each message? If so, you could rule out messages without attachments by reading the Content-Type. If it's not a multipart message then it doesn't have an attachment. However, I do not believe you can prove that a message does have an attachment without downloading the contents of the message.


If content type is "multipart/mixed" then there is an attachment in the Email.

0

精彩评论

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

关注公众号