File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Other JSE/JEE APIs and the fly likes Mail API content type 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 "Mail API content type" Watch "Mail API content type" New topic

Mail API content type

Jigar Naik
Ranch Hand

Joined: Dec 12, 2006
Posts: 761

in the code above i'm passing array list as an arg to my function below

but i'm not able to send arrat list as a message body.the actual thing i want to pass is hash map it self...HOW DO I PASS HASH MAP OR ARRAY LIST AS AN ARGUEMENT ???


Jigar Naik

Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63837

Moved to Other Java APIs where JavaMail is discussed.

[Asking smart questions] [About Bear] [Books by Bear]
Joe Ess

Joined: Oct 29, 2001
Posts: 9188

Please KeepItDown.
There's no mime type for representing array lists or hash maps. You need to render the data you are sending as some sort of document so the mail reader on the receiving end can make sense of it.

[How To Ask Questions On JavaRanch]
Jigar Naik
Ranch Hand

Joined: Dec 12, 2006
Posts: 761
sorry for caps letter... i did not mean it what you thought...

there is no mime type for passing hash map or array list to messagebodypart...

atlast i had to pass string as an arguement...

what i did is picked every key value pair of hash map and concat it to a String message;

but i feel it's not a good solution.
Paul Clapham

Joined: Oct 14, 2005
Posts: 19973

Another solution would be to serialize your data to a byte array, then attach that as if it were a file.
I agree. Here's the link:
subject: Mail API content type
jQuery in Action, 3rd edition