How can I make a Message object from a text file / input stream (in RFC-822 format)?
Created May 4, 2012
Eric Aubourg If your text file input stream is istr, just do:
javax.mail.internet.MimeMessage msg = new javax.mail.internet.MimeMessage(sess, istr);
where sess is a JavaMail session. If you need to create a session (for instance, you just want to parse the text file using Message methods):
class MyAuthenticator extends javax.mail.Authenticator {} javax.mail.Authenticator auth = new MyAuthenticator(); java.util.Properties prop = new java.util.Properties(); javax.mail.Session sess = javax.mail.Session.getInstance( prop, auth);