-1

I am attempting to add attachments from an InputStream object, and send them by email. Like this example:

for(Document d: listDocumentAttached) {
            InputStream file = null;
            TypeString type = new TypeString();
            TypeString name = new TypeString();

            try {
                file = APIcenter.recoverDocument(d.getREF(), type, name); //This confidential API method return an InputStream object
            } catch (ApiCenter Exception e) {
                e.printStackTrace();
            }

            email.addAttachment(d.getNAME(), new InputStreamSource(file), type.toString()); //Cannot istantiate InputStreamSource from Eclipse platform
//org.springframework.core.io.InputStreamSource is abstract; cannot be instantiated

        }

Similar questions with no clarify my clue: How can convert inputstream to InputStreamsource or Datasource to attach in Spring JavaMail

How to send email with attachment using InputStream and Spring?

Many thanks for your grateful help! :)

Learn something new about sending emails

crmaidev
  • 1
  • 3

0 Answers0