This week's book giveaway is in the Android forum.
We're giving away four copies of Head First Android and have Dawn & David Griffiths on-line!
See this thread for details.
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

Win a copy of Head First Android this week in the Android forum!
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: 760

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: 63053

Moved to Other Java APIs where JavaMail is discussed.

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Joe Ess

Joined: Oct 29, 2001
Posts: 9126

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: 760
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: 19693

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
It's not a secret anymore!