I am try to attach a ready pdf file to mail using java,so for that I have try below
String filename = "file.pdf";
ByteArrayOutputStream bos = new ByteArrayOutputStream();
??.write(bos);
DataSource fds = new ByteArrayDataSource(bos.toByteArray(), "application/pdf");
MimeBodyPart mbp2 = new MimeBodyPart();
mbp2.setDataHandler(new DataHandler(fds));
mbp2.setFileName(filename);
I am ot understand what will be instead of '??'. so please suggest me about that.