Okay, I think I get it. You want to compress "attachments", but not the "mail body" and text attachments are throwing you because they look like the mail body.
That's going to be tricky - don't forget that MIME entities can nest, you often have to process them recursively. (Think of a MIME message which has an attached MIME message, like a mail forward...)
There are also semantic considerations - such as what the effects might be of compressing parts of an entity of type multipart/related, you might break the composite entity.
But speaking in terms of a quick-and-dirty solution that works 90% of the time, I'd say go ahead and key off the presence of a suggested file name. Process the message entity by entity, and if there's a filename suggestion (in content-type or content-disposition, as you saw) then assume it's an attachment and replace it with a compressed version of itself.
You can throw in some heuristics to make it little more robust, like never compressing the first text entity you come across, never compressing a single-part message (only one entity), and not descending inside of multipart/alternative entities (which often contain the text/html and text/plain versions of the "message body").
Good luck! | [reply] |
hey McD,
Thanks again for your time n help...
its really helpfull to me.
i have done this by attachments filename and its working ...
| [reply] |