dcsimg
How do i send multiple attachments?
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   karthik_babu
Posted On:   Thursday, July 5, 2001 08:01 AM

I am having a java mail client.I am able to send only one attachement at a time .but i need to send multiple attachments.If i send multipla attachments it is throwing exception file not found and Io exception.Plzzzzzzzzzzz help

Re: How do i send multiple attachments?

Posted By:   Becky_Givner  
Posted On:   Thursday, July 5, 2001 09:34 AM

To send multiple attachments, create a body part for each file that you want to send.


Check out the sample code from this tutorial on the JavaMail API:


http://developer.java.sun.com/developer/onlineTraining/JavaMail/contents.html#SendingAttachments


Here is the code you would need to repeat per file:



messageBodyPart = new MimeBodyPart();
DataSource source = new FileDataSource(filename);
messageBodyPart.setDataHandler(new DataHandler(source));
messageBodyPart.setFileName(filename);
multipart.addBodyPart(messageBodyPart);




About | Sitemap | Contact