Skip to Content
0
Dec 05, 2022 at 07:04 PM

Mail Sender Adapter: Read attachment with .msg extention

392 Views

Hi All,

I am migrating mail to proxy interface to cpi. Mail sender is picking the mails with attachments and sends its to proxy receiver.

we can see all attachments in the mail sender but after start step, looks like .msg message attachment seems to be missing.

mail.png

We can see the message/rfc822 in the sender mail

sender-mail.png

but it does not show up after start step. For example, in the script, rfc822 attachment is missing.

attachments-name.png

import com.sap.gateway.ip.core.customdev.util.Message
import javax.activation.DataHandler
import java.util.Map

def Message processData(Message message) {

     def messageLog = messageLogFactory.getMessageLog(message)

    Map<String, DataHandler> attachments = message.getAttachments();
   
    
    // loop over keys
    StringBuilder br = new StringBuilder();
    
    attachments.each{key, val ->
    br.append("$key = $val")
   br.append("\n")
        
    }
    
    messageLog.addAttachmentAsString("attachmentmapkeys", br.toString(), "text/plain");
     
   
    return message
}

Regards,

Muni