Wietse, I have an implementation wherein the smtp library(http://code.google.com/p/subethasmtp/) is delivering the mail byte stream to my custom logic, here by using javax mail api I am able to strip the attachments etc. out of the byte stream.
But since there are lots of cases that I need to cater to that's why I am looking for a MIME processor that does this all catering to all of the possible cases (like text/html, text/plain, multipart/alternative, multipart/mixed, multipart/related etc) on the backend. Currently in case of javax mail api I had to manually check out the mime types etc and parse them by using api abstractions and related methods which is proving to be quite involved and confusing. Please suggest such a MIME processor (preferably in java or C#) that I can use as a custom library and lessen the complexity of parsing MIME by using javax mail api. Thanks in advance Ashish Sharma -----Original Message----- From: owner-postfix-us...@postfix.org [mailto:owner-postfix-us...@postfix.org] On Behalf Of Wietse Venema Sent: Wednesday, April 21, 2010 8:17 PM To: Postfix users Subject: Re: Email attachment parsing via mime4j Sharma, Ashish: > Hi, > > I am using a small java smtp library > (http://code.google.com/p/subethasmtp/), by this I need to parse > the incoming emails in separate components viz body, attachments > etc. > > I am trying to use mime4j , but the documentation suggests that > mime4j can only give event notification or token notification and > nothing else. For stripping out body and attachments etc I had to > use my own custom logic inside the event handlers. Is my observation > correct? > > If yes then how can I use mime4j to use for my requirement. Please > suggest. > > I need an approach that takes in the smtp data stream and returns > me with an array of attachment references or streams in fully > parsed out form in java. Please help. There are two options. 1) Have an existing MTA deliver the mail to your program as a local file, or as a byte stream over a local IPC channel. 2) Have an existing MTA deliver the mail to your program over SMTP, in which case you need to combine the MIME processor with an SMTP engine (preferably one that already exists). Wietse