Win a copy of Node.js Design Patterns: Design and implement production-grade Node.js applications using proven patterns and techniques this week in the Server-Side JavaScript and NodeJS forum!
  • 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 ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

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 ]
 
His brain is the size of a cherry pit! About the size of this ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic