cancel
Showing results for 
Search instead for 
Did you mean: 

receive an email attachment and process it

Former Member
0 Kudos

Hello all,

could you please explain me, how can I process an email attachment, that comes into XI? My scenario is follows: I receive a mail with attachment into XI, search in attachment to which email this message should be forward and forward the modified message to receiver.

I' ve done successful the similar scenario with java mapping, where an incoming IDOC was parsed and mapped to mail message with attachment. Outgoing mail structure was in this case follows:

<?xml version="1.0"; encoding="UTF-8"?>

<ns:Mail xmlns:ns="http://sap.com/xi/XI/Mail/30">

<Subject>=?utf-8?Q?Subject?=</Subject>

<From>"mailSender"&lt;mail@mail.com&;gt;</From>

<To>"mailReceiver"&lt;tomail@mail.com&;gt;</To>

<Content_Type>multipart/mixed; boundary="--AaZz"</Content_Type>

<Content>----AaZz

Content-Type: text/plain; charset=UTF-8

Content-Disposition: inline

Confirm with attachment.

----AaZz

Content-Type: application/xml;

name=Auftrag.xml

Content-Disposition: attachment;

filename=confirm.xml

<?xml version=&quota;1.0&;quot; encoding="UTF-8>

</Content></ns:Mail>

Now I try to repeat this, but I don't get such incoming structure from pipeline. I always see there two payloads: mailMessage and mailAttachment. Could anybody tell me, how have I to configure send channel to get such structure by receiving a mail into xi in xi payload? Is it possible? if no, than how can I handle with attachment of incoming mail message?

thanks in advance

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Anna !

Check this blog:

/people/michal.krawczyk2/blog/2005/12/18/xi-sender-mail-adapter--payloadswapbean--step-by-step

Regards,

Matias

ps: please award points if helpful.

Former Member
0 Kudos

Hello Mathias,

I know this blog, as you can see in the message monitoring this mail message is devided into two parts: two Content-IDs with different payload IDs. The first payload is ended with tags </Content></xim:Mail> and the second payload contens attachment content. There for I have two "payloads" in xi: mailMessage and mailAttachment.

Exactly this I will avoid. I need both parts under <content> devoted with boundary string.

may be you know, how I can transform mail attachment to message body with swap been?

thanks

Former Member
0 Kudos

Hi Anna !

If you need both, then I think that you should create a java proxy client to retrieve the mail and unify mail body and attachment as a unique message.

Check this thread:

Regards,

Matias

Former Member
0 Kudos

thank you, but are you sure, that I realy need proxy? In your link the proxy was used to send a message into CRM or not?

I just need to convert an attachment message into mail message. A content of a mail message is not important for me, it can be lost. Do you know, whether I can do it with Swap Beans? Just swap body with attachment?

Former Member
0 Kudos

Hi Anna !

I think I don't understand. If you need to swap mail body with attachment and keep only the attachment, then the provided link for the blog should do the trick. Just follow that step by step guide to use the PayloadSwapBean.

Regards,

Matias

Former Member
0 Kudos

Matias, let me explain once more.

With this blog, that you advised me: /people/michal.krawczyk2/blog/2005/12/18/xi-sender-mail-adapter--payloadswapbean--step-by-step, you can transform body of email into email attachment. I checked it just now.

Also if you send email with content "hello", you get nothing in content of incoming MailMessage, but "hello" in AttachmentMessage.

I need it inversely: I send mail with attachment and expect an AttachmentMessage in MailMessage. Do you know, how I can get it?

Former Member
0 Kudos

Anna:

Have you already tested the steps of the blog?

It clearly says:

When you configure the rest of the data inside Integration Directory and do some more tests

*we should be able to see that the message which goes to our interface mapping*

+is actually the attachment and not the main payload itself.+

And also check your MIME headers, maybe your payloadswapbean is not correctly configured. As you stated, your "hello" should appear as "attachment", BUT any attachment that you may send, it should appear as the real PAYLOAD. If it doesn't happen, maybe you are "swapping" the wrong header/content sections of the incoming mail.

Regards,

Matias

Former Member
0 Kudos

yes, I have already done it: step by step. You are right, payload appears as attachment, but not inversely!

For example if I send an email with attachment or/and with body content to this channel, I receive in XI two contens MailMessage and AttachmentMessage, so as I have sent. It does not work... I configured swapbean module as it was in blog:

swap.keyName Content-Disposition

swap.keyName Content-Description

swap.keyValue attachment;filename="MailAttachment-1.xml"

swap.keyValue MailAttachment-1

thank you a lot that you help me

Former Member
0 Kudos

Hi Anna !

Try to do this:

Send an email to the email account configured in the mail sender adapter, but avoid XI to pick it up. Instead, downloaded with your mail client (webmail or something like outlook). There should be an option to see the mail in RAW format, with all headers and content, sometimes refered as "original message". And try to find the headers related to the attachment, like the ones below as stated in the blog. Maybe in your case the header is a different one and payloadswapbean should be configured differently. And also be sure that your attachment is already in XML, if not, XI will not be able to send it to the integration engine for mapping.

Regards,

Matias.

ps: please award points if helpful.

[...]

--SAP_1c3f0981-6fe8-11da-82b2-000d601c4c42_END

Content-ID: <payload-29ddfbd56f0e11da8acc000d601c4c42@sap.com>

Content-Type: text/xml;name="=?iso-8859-2?Q?abcdefg.xml?="

Content-Disposition: attachment;filename="MailAttachment-1.xml"

Content-Description: MailAttachment-1

?<?xml version="1.0" encoding="UTF-8"?>

<ns0:inside xmlns:ns0="http://frik.com">

<name>

<nameone>somename</nameone>

</name>

</ns0:inside>

[...]

Edited by: Matias Denker on Jan 4, 2008 11:44 AM

Former Member
0 Kudos

Hello Matias, thank you for your advices, it runs now, thanks once more!