[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

How to send Email with 2 or many attached files

Posted on 2006-04-12
3
Medium Priority
?
194 Views
Last Modified: 2010-04-01
Hi Experts

How can i send email  with 2 files attached with it from my JSP Page using JavaMail.

Thanx
0
Comment
Question by:massrico
  • 2
3 Comments
 
LVL 11

Expert Comment

by:fargo
ID: 16436665
0
 
LVL 11

Accepted Solution

by:
fargo earned 750 total points
ID: 16436674
for sending multiple files the following may help
File[] attachments=new File{"file1" ,"file2","file3"}

for( int i = 0; i < attachments.length; i++ )
{
    messageBody = new MimeBodyPart();

    FileDataSource fileDataSource =new FileDataSource(attachments[i]);
    messageBody.setDataHandler(new DataHandler(fileDataSource));
    messageBody.setFileName(attachments[i].getName());
           
    multipart.addBodyPart(messageBody);
}
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will help to fix the below errors for MS Exchange Server 2016 I. Certificate error "name on the security certificate is invalid or does not match the name of the site" II. Out of Office not working III. Make Internal URLs and Externa…
Often times it's very very easy to extend a volume on a Linux instance in AWS, but impossible to shrink it. I wanted to contribute to the experts-exchange community a way of providing a procedure that works on an AWS instance. It can also be used on…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question