Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to set the Content type in JavaMail

 
arun mahajan
Ranch Hand
Posts: 305
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Everybody,
I was trying to do the following in my send mail program:-
1. I am making a file using FileWriter:
FileWriter fw = new FileWriter(f);
fw.write(str);
2. I now want to attach this file with my mail. but before that I want to set the Content type of this as "application/smil". and trying the following code:
mimebodyparts[0].setContent(fds[0],"application/smil");

But when I recieve the mail and check the content type it shows "application/octet-stream".
I'd be highly obliged if some body help me to set the content type right for the above.
regards,
Arun
 
arun mahajan
Ranch Hand
Posts: 305
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tired to dig into further and found that it is senidng the mail as I am trying to et the content type at wrong position and the program as not able to determine the ontent type is setting as octet-stream.
Now new problem has arised after putting the code right. While trying to send the mail it throws an exception
javax.activation.UnsupportedDataTypeException: no object DCH for MIME type application/smil
I tried to find the answer into th enet and got that I need to change the mailcap file. I found the same in the activation jar package but thought instead of chagning the default file i tried putting following code in my program:

and in simple.mailcap file put the following value

but the problem still persists.
Can somebody Please help to sort this out.
regards,
Arun
 
arun mahajan
Ranch Hand
Posts: 305
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oops no taker for this question....I thought this is the best forum at javaranch...Can you take care for me Cindy?
Arun
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic