开发者

Read text file of Email convert to Javamail MimeMessage

开发者 https://www.devze.com 2023-03-18 19:27 出处:网络
I have a text file of the original source of an email(just straight copied from gmail if you click on \"View Original\" you\'ll see it). I want to read this file in and convert it into a MimeMessage.

I have a text file of the original source of an email(just straight copied from gmail if you click on "View Original" you'll see it). I want to read this file in and convert it into a MimeMessage.

If you are curious as to why, I have JavaMaildir set up, and need to populate it's inbox with emails for testing purposes. I've never really dealt with reading fi开发者_开发百科les and all this, so any help would be great thanks.


Something like this should work:

InputStream mailFileInputStream = new FileInputStream(...);
Properties props = new Properties();
Session session = Session.getDefaultInstance(props, null);
MimeMessage message = new MimeMessage(session, mailFileInputStream);
...
0

精彩评论

暂无评论...
验证码 换一张
取 消