how to attached mail with file that store in binary format in database ??
the code below is attached thru the browse button with the file path
because the attachment is store in binary format, how do i modify my code to get the mail attached with the attachement
File Name : [ C:\README.txt ] BROWSE
if (hasAttachment) {
// avoid the case with no text parts
MimeBodyPart bodyPart = new MimeBodyPart();
bodyPart.setContent("Attachment enclosed.", "text/plain");
mp.addBodyPart(bodyPart);
// the part with the file
FileDataSource fds =
new FileDataSource(bean.getAttachedFileName());
MimeBodyPart attachmentBodyPart = new MimeBodyPart();
DataHandler dh = new DataHandler(fds);
attachmentBodyPart.setDataHandler(dh);
attachmentBodyPart.setFileName(fds.getName());
mp.addBodyPart(attachmentBodyPart);
}
msg.setContent(mp);