views:

42

answers:

2

Can you determine if a 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.

A: 

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.

Kevin Ballard
Yes I have the Content-Type but your right about it doesn't prove it has attachments as I dont count the "body.eml" as a attachment
Rhett Leech
+2  A: 

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.

paxdiablo
Thanks, I'll need to add to my doco that the POP3 must support the TOP Command
Rhett Leech