I am trying to attach file in my mail app. but all time only body has been sent. I am using method:
public void addAttachment(String path) throws Exception
{
BodyPart messageBodyPart = new MimeBodyPart();
DataSource dataSource = new FileDataSource(path);
messageBodyPart.setDataHandler(new DataHandler(dataSource));
messageBodyPart.setFileName(path);
Multipart multipart = new MimeMultipart();
multipart.addBodyPart(messageBodyPart);
}
I have used two jar file mail.jar, activation.jar. mail body is working fine. but attachment is not reached.
Your method looks the exact same as what I use and works.
But what I want to know is how you’re calling the method?
Or something like that?