Thanks for the directions ;)

A simple "new MimeMultipart(part.getDataHandler().getDataSource());"
does the trick!

I've written a test case which submits an embedded message in one of
the multipart/mixed and this conversion works fine even recursively.

Thanks for the help,
A+, Dom


On Nov 8, 1:40 am, "zhiw...@gmail.com" <zhiw...@gmail.com> wrote:
>             Properties props = new Properties();
>             Session session = Session.getDefaultInstance(props, null);
>             Message message = new MimeMessage(session,
> request.getInputStream());
>
>             String subject = message.getSubject();
>
>             DataHandler dataHandler = message.getDataHandler();
>             DataSource dataSource = dataHandler.getDataSource();
>             MimeMultipart mimeMultipart = new MimeMultipart
> (dataSource);
>
>             Part part1 = mimeMultipart.getBodyPart(0);
>             // get the content use common io, i use chinese, so i set
> the encoding gb2313
>             String content = IOUtils.toString((InputStream)
> part1.getContent(), "gb2312");
>
> it is receiving mail demo, it works well
>
> On Nov 8, 12:48 pm, m seleron <seler...@gmail.com> wrote:
>
> > Hi
>
> > GAE's getContent (or javamailAPI current version ?) is
> > message.isMimeType ( "multipart / *") even when the
> > ByteArrayInputStream so to return.
>
> > When the isMimeType is multipart try to convert this source
>
> > InputStream inputStream = (InputStream)mimeMessage.getContent();
> > String ContentType = mimeMessage.getContentType();
> > ByteArrayDataSource byteArrayDataSource = new ByteArrayDataSource
> > (inputStream,ContentType);
> > Multipart mimeMultipart = new MimeMultipart(byteArrayDataSource);
>
> > Please try variously.
>
> > thanks
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to google-appengine-java@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to