cancel
Showing results for 
Search instead for 
Did you mean: 

Mail Sender Adapter: Read attachment with .msg extention

Muniyappan
Active Contributor
0 Kudos

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.

We can see the message/rfc822 in the sender mail

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

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

Accepted Solutions (1)

Accepted Solutions (1)

Muniyappan
Active Contributor
0 Kudos

We have raised SAP incident and SAP replied to re create the sender mail channel as old channel is created using old cpi version. After re creating the sender channel has fixed the issue. Looks like SAP fixed this issue with cpi release.

Answers (1)

Answers (1)

Muniyappan
Active Contributor
0 Kudos

I have tried to use camel simple expression in the content modifier(placed after start) as per below blog. It works for other attachment like pdf, txt but not for .msg type.

${exchange.getIn().getAttachmentNames()[0]}

https://blogs.sap.com/2020/03/17/how-to-handle-sap-cpi-attachments-via-apache-simple-in-content-modi...