cancel
Showing results for 
Search instead for 
Did you mean: 

How to retrieve an attached PDF file that is encoded in Base64 from a mime multipart format email

kohei1sada
Explorer
0 Kudos
363

How to retrieve an attached PDF file that is encoded in Base64 from a mime multipart format email

Please share any ideas you may have.

I'm considering implementing this in Groovy

Environment is Integration Suite CloudIntegraion IntegrationFlow

Cloud Integration SAP Integration Suite @ash_G 

Accepted Solutions (1)

Accepted Solutions (1)

Sourav1
Participant
def attachments = message.getAttachments();
attachments.values().each{ attachment ->
  def inputStream = attachment.getInputStream();
  def result = new ByteArrayOutputStream();
  def buffer = new byte[1024];
  def length;
    while ((length = inputStream.read(buffer)) != -1) {
        result.write(buffer, 0, length);
     }
  def byteArray = result.toByteArray();
   message.setProperty("attachment_body", byteArray);
}
 
kohei1sada
Explorer
0 Kudos
Thank you very much. I will check it out. Also, there was already a MIME decoder as a standard feature. I will try that as well. Thank you for your time.

Answers (0)