Currently, I am making use of the Javamail api to send out mails with attachments. It is currently implemented by initialising the DataSource to FileDataSource. However, for this to work, a physical file must exist in the system.
I was wondering if there is any way in which we can attach the attachments directly from an InputStream.
Currently, the code we use to attach the attachment is:
messageBodyPart = new MimeBodyPart();
DataSource source = new FileDataSource(attachmentFiles[i]);