Hi Vikramjit
The multiple attachment works but I cannot send the message now..,
How do I set the message ?
Everything is fine except the message ...
// create and fill the first message part
messageBodyPart = new MimeBodyPart();
messageBodyPart.setText(message);
Multipart multipart = new MimeMultipart();
for (int i =0; i < 2; i++)
{
// This is for displaying the name of the attachment
String nameOfAttachment = "c:/example.txt";
System.out.println(nameOfAttachment);
// This part of the code is for attaching the file to the message
FileDataSource source = new FileDataSource(nameOfAttachment);
messageBodyPart.setDataHandler(new DataHandler(source));
//The name of attachment which is to be displayed is set.
messageBodyPart.setFileName(nameOfAttachment.trim());
multipart.addBodyPart(messageBodyPart);
}
msg.setContent(multipart);
// msg.setHeader("X-Mailer", mailer);
msg.setSentDate(new Date());
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:
http://archives.java.sun.com/jsp-interest.html
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.jsp
http://www.jguru.com/faq/index.jsp
http://www.jspinsider.com