From mime4j-dev-return-1593-apmail-james-mime4j-dev-archive=james.apache.org@james.apache.org Fri Jul 1 10:55:25 2011 Return-Path: X-Original-To: apmail-james-mime4j-dev-archive@minotaur.apache.org Delivered-To: apmail-james-mime4j-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 10BD84C0E for ; Fri, 1 Jul 2011 10:55:25 +0000 (UTC) Received: (qmail 74677 invoked by uid 500); 1 Jul 2011 10:55:24 -0000 Delivered-To: apmail-james-mime4j-dev-archive@james.apache.org Received: (qmail 74616 invoked by uid 500); 1 Jul 2011 10:55:22 -0000 Mailing-List: contact mime4j-dev-help@james.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: mime4j-dev@james.apache.org Delivered-To: mailing list mime4j-dev@james.apache.org Received: (qmail 74596 invoked by uid 99); 1 Jul 2011 10:55:20 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 01 Jul 2011 10:55:20 +0000 X-ASF-Spam-Status: No, hits=-2.3 required=5.0 tests=RCVD_IN_DNSWL_MED,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [15.192.0.46] (HELO g5t0009.atlanta.hp.com) (15.192.0.46) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 01 Jul 2011 10:55:12 +0000 Received: from G1W0400.americas.hpqcorp.net (g1w0400.americas.hpqcorp.net [16.236.31.10]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (No client certificate requested) by g5t0009.atlanta.hp.com (Postfix) with ESMTPS id 839A4303A0 for ; Fri, 1 Jul 2011 10:54:50 +0000 (UTC) Received: from G3W0628.americas.hpqcorp.net (16.233.58.53) by G1W0400.americas.hpqcorp.net (16.236.31.10) with Microsoft SMTP Server (TLS) id 8.2.176.0; Fri, 1 Jul 2011 10:53:24 +0000 Received: from GVW1154EXB.americas.hpqcorp.net ([16.232.35.141]) by G3W0628.americas.hpqcorp.net ([16.233.58.53]) with mapi; Fri, 1 Jul 2011 10:53:24 +0000 From: "Sharma, Ashish" To: "mime4j-dev@james.apache.org" Date: Fri, 1 Jul 2011 10:53:19 +0000 Subject: RE: Using mime4j for parsing incoming emails Thread-Topic: Using mime4j for parsing incoming emails Thread-Index: Acw0yXqXce0+Gr8STxqjr4/HHIAnzQDEtsYg Message-ID: <3439D88AC8B9534AB0C26F8CA8F055C66D6A07C4C7@GVW1154EXB.americas.hpqcorp.net> References: <3439D88AC8B9534AB0C26F8CA8F055C66D69DF79A9@GVW1154EXB.americas.hpqcorp.net> <4E087D7C.3000808@apache.org> In-Reply-To: <4E087D7C.3000808@apache.org> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Virus-Checked: Checked by ClamAV on apache.org Norman, I got the following idea from one of the forums: "decode the attachments and then re-encode them. If the re-encoded stream m= atches (byte-for-byte) the original, then that's a good sign that mime4j is= properly handling them" http://stackoverflow.com/questions/6521010/verifying-testing-the-output-of-= mime4j-parsed-content What is your comment on this and what classes should I use for implementing= the suggestion? Thanks Ashish -----Original Message----- From: Norman Maurer [mailto:norman@apache.org]=20 Sent: Monday, June 27, 2011 6:24 PM To: mime4j-dev@james.apache.org Subject: Re: Using mime4j for parsing incoming emails Hi there... mime4j ships with many tests to check if does the right thing. Anyway=20 I'm almost sure the test don't cover everything.. You will need to read=20 the rfc to really understand if the email is parsed correctly. I would=20 only do this if you think it does not the right thing. For Testing I suggest you to write junit tests... Bye, Norman Am 27.06.2011 14:44, schrieb Sharma, Ashish: > Hi, > > I have a project where I need to parse incoming email streams provided in= raw form and parse them out in their constituents viz (email body as separ= ate file and email attachments as separate file). > > I am able to do this by extending the class org.apache.james.mime4j.messa= ge.SimpleContentHandler. > > Here I am facing following problem and request suggestions for that: > > 1. Since I have raw emails and I am parsing them out in their constituent= s, how can I test whether the parsing is working fine for a large corpus of= raw emails that I have to use to test the efficiency and correctness of th= e mime parsing by mime4j. > How can I write test cases for such a scenario? > > Meaning how would I be able to determine whether the file that was parsed= out is correctly parsed by mime4j or not? > > 2. Any other kind of testing that I need to implement for improvement? > > Thanks > Ashish