This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Other JSE/JEE APIs and the fly likes Java Mail Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "Java Mail" Watch "Java Mail" New topic

Java Mail

Dave Hewy
Ranch Hand

Joined: Aug 21, 2003
Posts: 93
Does anyone know of a utility class out there that just takes an object of type Message (or similar) and returns an object representing the email including the attachments etc?

Maybe it can do the opposite as well?

Seems like loads of people are writing code that is almost identical !

Paul Sturrock

Joined: Apr 14, 2004
Posts: 10336

Perhaps I am missunderstanding something, but a Message is an object representing the email. Perhaps you can explain what you are trying to do?

JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Dave Hewy
Ranch Hand

Joined: Aug 21, 2003
Posts: 93
Yeah - sorry, not made myself too clear.

You're right that it's a representation of an email, but you have to put a bit of work in to get all the bits out if you have file attachments, embedded attachments, pictures, embedded emails etc.

What would be good is an email object where all this has been done, so it may have methods that return a collection of all attachments for example, as byte arrays or similar.

Now I've had time to mess around with the classes, it's not that bad to have to do this yourself, but do you get what I mean?

It is sorta covered in the JavaRanch Style Guide.
subject: Java Mail