cancel
Showing results for 
Search instead for 
Did you mean: 

Mail sender with different attachment names?

peter_wallner2
Active Contributor
0 Kudos

Dear experts,

I have a scenario Mail --> PI --> FTP. I need to get an attachment from the email.

I have been looking at these blogs:

http://scn.sap.com/people/michal.krawczyk2/blog/2005/12/18/xi-sender-mail-adapter--payloadswapbean--...

http://scn.sap.com/people/gaurav.agarwal11/blog/2012/04/12/handling-attachments-in-mail-to-file-scen...

They tell you when using the PayloadSwapBean in the module configuration you have to specify the attachment name using:

"swap.keyValue" with

attachment;filenmae="Input.xml"

But what if my attachment names vary? My attachments could be named "110_file.xls" or "116_file.xls" and so on.

How can I use the PayloadSwapBean module then?

Can I also somehow tell the mail sender adapter to only process emails with attachments "*.xls"?

Thank you for any hints on that,

Peter

Accepted Solutions (1)

Accepted Solutions (1)

stefan_grube
Active Contributor
0 Kudos

An undocumented feature of the PayloadSwapBean is the fact, that the swap keyValue can be used as part of the String. So when you want to use any xls as main payload, just type .xls as keyValue.

peter_wallner2
Active Contributor
0 Kudos

Thank you Stefan, ".xls" works fine as keyValue.

Best regards,

Peter

Answers (2)

Answers (2)

peter_wallner2
Active Contributor
0 Kudos

If anyone ever faces a similar scenario, read an EXCEL (.xls) attachment from an email, convert the attachment to XML and keep the attachment file name:

I used the following adapter modules:

PayloadSwapBean

ConvertExcelToXML (http://wiki.sdn.sap.com/wiki/pages/viewpage.action?pageId=140640463)

GetAttachmentName (http://wiki.sdn.sap.com/wiki/display/XI/Adapter+Module+PI+7.0+Get+Attachment+Name)

and after that the Standard mail adapter.

Best regards,

Peter

zameerf
Contributor
0 Kudos

Hi Peter,

Did you refer the recent thread?

http://scn.sap.com/message/13534287

I guess you have to code a custom module to achieve this requirement.

You can also refer the wiki to get the code.

http://wiki.sdn.sap.com/wiki/display/XI/Adapter+Module+PI+7.0+Get+Attachment+Name

-Zameer

peter_wallner2
Active Contributor
0 Kudos

Hello Zameer,

You are right, I had to use the java code from the WIKI, but also had to adapt it because we are on PI 7.3. The method "setMessageProperty" with 3 String arguments is deprecated, I had to use it with only 2 arguments - 1 Message property key and 1 String.

Best regards,

Peter