I need to see the raw content of a message - that is, with all the MIME headers and delimeters - and not just the plain text. In other words, the content that you would see if your email client was written before MIME was written. How can I do this via JavaMail (or an alternative)?
UPDATE:
I'm not sure whether you want to see the raw MIME content of an existing message, or whether you have the raw MIME content and want to do something with it.
For the former, see the MimeMessage.writeTo method.
For the latter, see the MimeMessage constructor that takes an InputStream.
If you already have JavaMail for pulling javax.mail.MimeMessage
s off some datastore, you can simply call it's getInputSream() method to access the raw content and ignore the fact that getContent()
will conveniently provide a MimeMultiPart
object.
If you don't have JavaMail, you probably want to be more specific on your input. Email is all text, so wherever you get it from doesn't matter much as long as you can get an InputStream
or a Reader
for that source.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.