• Post Reply Bookmark Topic Watch Topic
  • New Topic

JavaMail: Implement DataSource in javax.activation package

 
Bruce Jin
Ranch Hand
Posts: 672
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In my java program I need to send some generated contents as e-mail attachment. But I found that the javax.activation only comes with a FileDataSource that implements DataSource. This can be used to send a file:
DataSource source = new FileDataSource(filename);
How do I implement DataSource so that I have something like InputStreamDataSource so that I can send some generated contents in my java program as e-mail attachment?
Thanks.
Bruce
 
manoj bagul
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Bruce,
Is the content which u r generating is available before sending mail or during the mail is processing.
If it is generated before mail program then u can store the generated content in a file and user the DataSource.

This might help u.
Manoj.
 
Bruce Jin
Ranch Hand
Posts: 672
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The contents is generated on the fly and is not in a file.
I found a ByteArrayDataSource in JavaMail download. This serves my needs.
Bruce
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!