• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to set the Content type in JavaMail

 
Ranch Hand
Posts: 305
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
reply
    Bookmark Topic Watch Topic
  • New Topic