• 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

JavaMail and attaching image

 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am sending a mail through javamail.I can send mail with html message.But when i try to attach image with multipart i get following exception
javax.mail.SendFailedException: Sending failed;
[Mon Jul 14 14:25:21 BST 2003] stderr: nested exception is:
[Mon Jul 14 14:25:21 BST 2003] stderr: javax.mail.MessagingException: IOException while sending message;
[Mon Jul 14 14:25:21 BST 2003] stderr: nested exception is:
[Mon Jul 14 14:25:21 BST 2003] stderr: javax.activation.UnsupportedDataTypeException: no object DCH for MIME type image/png

I can send html message then why can't i attach image with the message.Image i am trying to attach is not on server but on outpout stream.I am doing following for the same.
imageBodyPart.setDataHandler(new DataHandler(out,"image/png"));
i have been going through lot of posting..so guys
i have made sure following is true
mail.jar and activation.jar are on classpath
And yes i did read the JavaMail API on sun's website.
Thanks
Medha
 
Ranch Hand
Posts: 305
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It is because in the mailcap file (which you can find in activation.jar) is not having any entry for the png there. you need to have a viewer atleast to do a entry there.
Arun
 
Medha kamat
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Arun
Thanks for the reply.Ur right.I saw mailcap file and there is no entry for png type.I tried editing it with wordpad but then it saves that file in activation.jar and says file is saved without folder information...and it doesn't save it under right path
What is the best way to edit it?
Thanks
Medha
 
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 think it is not advisable to modifed the file. As per the APIs you can make your mailcap file and can achieve the same. As programatic mailccap file has precedance, though I am failed to achieve the same. Though there is very tricky way but is not recommended.
Arun
 
reply
    Bookmark Topic Watch Topic
  • New Topic