Can an e-mail's headers tell you if it has an attachment?
I'm trying to filter emails that have attachments, but in the system I'm using I only have access to the headers (for filtering). Is there a consistent way of determining if an e-mail contains attachments using only headers? (Perhaps checking if the content-type is multipart?)
Solution 1:
You cannot achieve your desired goal if you have access only to the headers. The information may be there as a non-standard header but that's obviously not something that you can rely on. Either get access to the body or abandon the idea.
Solution 2:
Mails without attachments may be content-type:multipart too, like those with text and html versions of the content. What you would have to check is c-t:multipart and then for parts that are not content-type:text/*, but for that you will need access to the body :(