Return-Path: Delivered-To: apmail-james-mime4j-dev-archive@minotaur.apache.org Received: (qmail 72694 invoked from network); 24 Jan 2011 10:42:58 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 24 Jan 2011 10:42:58 -0000 Received: (qmail 89575 invoked by uid 500); 24 Jan 2011 10:42:57 -0000 Delivered-To: apmail-james-mime4j-dev-archive@james.apache.org Received: (qmail 89520 invoked by uid 500); 24 Jan 2011 10:42:55 -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 89507 invoked by uid 99); 24 Jan 2011 10:42:53 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 24 Jan 2011 10:42:53 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [195.46.255.243] (HELO mailout1.pt.lu) (195.46.255.243) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 24 Jan 2011 10:42:45 +0000 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ah4FAArmPE3Vpjeg/2dsb2JhbACWR48QuwaFUASLIIMZDA X-IronPort-AV: E=Sophos;i="4.60,369,1291590000"; d="scan'208";a="33609266" Received: from hnl-secu.healthnet.lu (HELO secu.lu) ([213.166.55.160]) by smtp.pt.lu with ESMTP; 24 Jan 2011 11:42:25 +0100 Received: from [127.0.0.1] ([172.16.16.117]) by secu.lu (secu.lu [130.1.6.40]) (MDaemon PRO v10.0.1) with ESMTP id md50009165936.msg for ; Mon, 24 Jan 2011 11:42:23 +0100 X-Spam-Processed: secu.lu, Mon, 24 Jan 2011 11:42:23 +0100 (not processed: message from valid local sender) X-MDRemoteIP: 172.16.16.117 X-Return-Path: benoit.noss@secu.lu X-Envelope-From: benoit.noss@secu.lu X-MDaemon-Deliver-To: mime4j-dev@james.apache.org Message-ID: <4D3D578E.5050607@secu.lu> Date: Mon, 24 Jan 2011 11:42:22 +0100 From: Noss Benoit Organization: CISS User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.12) Gecko/20101027 Lightning/1.0b2 Thunderbird/3.1.6 MIME-Version: 1.0 To: mime4j-dev@james.apache.org Subject: Re: Headless mail renderer References: <4D3D19CB.4010602@secu.lu> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Checked: Checked by ClamAV on apache.org Hi Stefano, thanks for your answer. In the past, I already tried to do this with the javax.mail.Message class. it was not a big success..., and found lots of issues due to the variety of incoming mails, so couldn't get in production. With each parsed Message, I tried to build in parallel a xhtml page representing its content (From: To: Subject: Date: and body content) When the attachement was a message, I recursively went into it and appended info found in the xhtml I previously created When I found html, I tried to transform it to XHTML with tidy, then to PDF with iText when XHTML transformation failed and had a multipart/alternative, I then rendered txt to PDF When I found attached images, I rendered them to PDF When I found office documents I didn't transform them After that I merged all created PDF in one big PDF and checked it in to Documentum DB (for one message, one pdf) The aim of the project is not to have a pretty rendering of all mail, it's just to keep track of messages our client sent. I faced three big issues : ************************** 0/ multipart/mixed with inline image content in "cid:...." 1/ like you said html to pdf rendering is difficult and (tidy+iText or multipart/alternative) was not always working. If only I could use the Mozilla components to render it, but my understanding of it is not high enough 2/ Special caracters and encoding pb in headers and attached file names Beno�t. On 24.01.2011 09:34, Stefano Bagnara wrote: > 2011/1/24 Noss Benoit: >> I don't want to spam you with this question, but I would like to make an >> headless PDF mail renderer. >> In my project, I want to batch process incoming mails and inject them in a >> content management DB as PDF. >> Am I on the right way if I use your MimeStreamParser combined with a custom >> handler to make rendering? >> Can I access the content? Do you suggest something else for this? > You can use mime4j but you will have to manually deal with > attachments, multiparts/alternative to decide what part to render, > multipart/mixed to get inline images streams to be placed in the html. > And how do you plan to do headless html to pdf rendering? I think this > is the difficult task. Parsing with mime4j is easy: just look at some > example. > > Stefano