aspose file tools*
The moose likes Other JSE/JEE APIs and the fly likes saving a email as a .eml Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "saving a email as a .eml" Watch "saving a email as a .eml" New topic
Author

saving a email as a .eml

jordan ryan
Greenhorn

Joined: Oct 31, 2012
Posts: 19
Ok i can read an e-mail as attached below but i now need to be able to save this email as a .eml so i can view it when i click on the saved location.
I assumed a file writer then changing the println to Append would work but it didn't seem to work. is there any easy way around this.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19670
    
  18

First of all, available() doesn't do what you think it does.

Second, all you need to do is write the message to a file. Using Java 7's try-with-resources:


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
jordan ryan
Greenhorn

Joined: Oct 31, 2012
Posts: 19
Thanks rob i done a bit of googling and worked this out last night, thanks for the quick reply would have been useful.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19670
    
  18

You're welcome.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: saving a email as a .eml