Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
  • 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

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
 
These are not the droids you are looking for. Perhaps I can interest you in a tiny ad?
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic