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



Question:

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 downloading the whole message and counting the attachments.


Solution:1

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.


Solution:2

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.


Solution:3

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


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »