• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
  • Mikalai Zaikin

Java Mail: Please help: Can I create a new Message with InputStream (binary/character

Ranch Hand
Posts: 266
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi everyone,
I would to copy one message to another by replacing certain content of the mail.
I have for example one mail with attachments, containing both binary and character datas.
I would like to replace certain words in the body text (html) of the mail matching a pattern, before creating a new Message and copying the content of the old message to the new.
The html content and the parts should be preserved, so that images within the html-text should remain referenced.
First I iterated through the parts to get the body part which contains the html to replace the concerning words and to copy the parts to new ones. But the reference of the image tag to one attachment were not valuable any more.
So I had the idea to get the InputStream of the message:

But now I don't know how to get the InputStream in the new message. When I create a new MimeMessage(session, in) and I will send this message, the recipient will see the whole content as body content without any parts.
Does anybody have an idea?I would be very thankful for help.

Regards, Ulrich
[ August 29, 2005: Message edited by: Ulrich Heeger ]
    Bookmark Topic Watch Topic
  • New Topic