Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Create a MimeMessage from a RFC2822-formatted String

843834Mar 5 2009 — edited Mar 6 2009
Hi,

Could you suggest a way to create a MimeMessage from a String which is in the RFC2822 format?

For example,
String message = "From: John Doe <jdoe@machine.example> \n" + "To: Mary Smith <mary@example.net> \n"
+ "Subject: Saying Hello \n"
+ "Date: 21 Nov 97 09:55:06 GMT \n"
+ "Message-ID: <1234@local.machine.example> \n\n"
+ "This is a message just to say hello. \n";

Do you perhaps know a parser or a framework which offers support for this?

Thanks

Comments

Bill Shannon-Oracle
Well, hopefully that's not how you're creating the message!

But given a String that has only ASCII characters, you can use the (deprecated)
StringBufferInputStream class along with the MimeMessage constructor that
takes an InputStream.
1 - 1
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Apr 3 2009
Added on Mar 5 2009
1 comment
222 views