cancel
Showing results for 
Search instead for 
Did you mean: 
Subscribe

import com.sap.gateway.ip.core.customdev.util.Message

import java.util.Map

import java.util.Iterator

import javax.activation.DataHandler

def Message processData(Message message) {

def attachments = message.getAttachments();

def bTypeSupported = false;

if ((attachments!=null)&&(!attachments.isEmpty())) {

attachments.values().each{ attachment ->

if (bTypeSupported == true){

return;

}

def sContentType = attachment.getContentType()

message.setProperty("MailContentType", sContentType);

sContentType = sContentType.substring(0, sContentType.lastIndexOf(";")).toLowerCase();

if (sContentType.contains("csv")){

sContentType="text/csv";

bTypeSupported = true;

}

if (bTypeSupported == true){

message.setProperty("MailContentTypeSupported", "True");

message.setBody(attachment.getContent());

message.setHeader("attachment_fileName",attachment.getName());

message.setHeader("attachment_type",sContentType);

}

}

}

return message

}

0 Likes
View Entire Topic
amit023
Explorer
0 Likes

another problem is you cannot keep tracing enabled for longer duration and once again another pathetically designed adapter for handling things like attachment for which we have to take help from groovy script.