File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Other JSE/JEE APIs and the fly likes JavaMail: Implement DataSource in javax.activation package Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Reply Bookmark "JavaMail: Implement DataSource in javax.activation package" Watch "JavaMail: Implement DataSource in javax.activation package" New topic
Author

JavaMail: Implement DataSource in javax.activation package

Bruce Jin
Ranch Hand

Joined: Sep 20, 2001
Posts: 664
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

BJ - SCJP and SCWCD
We love Java programming. It is contagious, very cool, and lot of fun. - Peter Coad, Java Design

Crazy Bikes created by m-Power
manoj bagul
Greenhorn

Joined: Sep 20, 2001
Posts: 11
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

Joined: Sep 20, 2001
Posts: 664
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
 
 
subject: JavaMail: Implement DataSource in javax.activation package
 
Threads others viewed
JavaMail API error
What should be the value of 'host' when I send an e-mail?
Unable to import javax.activation.*
How to implement an interface?
Forwarding a mail in message/rfc822 Format
developer file tools

cast iron skillet 49er

more from paul wheaton's glorious empire of web junk: cast iron skillet diatomaceous earth rocket mass heater sepp holzer raised garden beds raising chickens lawn care CFL flea control missoula heat permaculture