cancel
Showing results for 
Search instead for 
Did you mean: 

Sending an attachment

Former Member
0 Kudos

Hi!

I've been trying to send an attachment which is a html file using the mail adapter. On the receiver side, I got an xml file with the html content but not the html itself. I tried to use the mail package but I did not know how to actually attach the html file. Please help!!

Regards,

Meghana

Accepted Solutions (1)

Accepted Solutions (1)

former_member183909
Active Participant
0 Kudos

I set up a simple test scenario in PI7.3 that will be able to read an email with an attachment and then forward that attachment via another email (you could also forward it to a file adapter or any other I guess).   In my scenario I had an attached XLSX spreadsheet.

You need to connect to email account and use the PayloadZipBean to unzip an attached file and use PayloadSwapBean to switch payload.   I am using tghe unzip to get to the internals of a spreadsheet so you probably won't do that for your attached html file.  

I found that the most important parameters where the GetAttachment sap.keyvalue =  MailAttachment-1  and swap.keyName Payload-Name.

Former Member
0 Kudos

Thank you Jonny! This is something new to me!

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Meghana,

Map constant text/html to field Content_Type from mail package xsd.

Regards,

Pranav

Former Member
0 Kudos

Hi Ram,

I did map that. But didn't get the expected output

Regards,

Meghana

Former Member
0 Kudos

Meghana,

In order to change the file name of the attachment in mail adapter, you have to write a custom adapter module to achieve it.

Below is the blog which can be used to write adapter module.

http://scn.sap.com/community/pi-and-soa-middleware/blog/2012/04/13/renaming-email-attachment-with-in...

This should work perfectly for your requirement.

Regards,

Veerendra.

Former Member
Former Member
0 Kudos

Hi Meghana,

You can get the mail package to send attachments at SAP note 748024, it has fields Content_Disposition, Content_Description, Content_Type.

Refer the document http://scn.sap.com/docs/DOC-16015 , uses XSLT to create mail package format and more options.

Regards,

Pranav

Former Member
0 Kudos

Thanks Veeru!! These links are very useful!

Former Member
0 Kudos

Hi Ram,

Thank you for pointing me to it!

Regards,

Meghana Sanagaram

former_member192892
Active Contributor
0 Kudos

Do you want the attachment to have the filename as <something>.html instead of maindocument.xml?

Regards

Varun

Former Member
0 Kudos

Yes Varun, that is one way of achieving it!

iaki_vila
Active Contributor
0 Kudos

Hi Meghana,

Aer you using the message protocol XIALL and the ContentDisposition with html?.

Check Michal Krawczyk's blog about this theme: http://scn.sap.com/community/pi-and-soa-middleware/blog/2005/11/23/xi-html-e-mails-from-the-receiver...

Regards.

Former Member
0 Kudos

Didn't work 😐

Former Member
0 Kudos

Hi Meghna

Have u created the XSLT mapping and try to populate the HTML message.

What error message are u getting??

Former Member
0 Kudos

Hi Indrajit,

I got the HTML messsage populated and yes, I used XSLT mapping for that. But the mail I received didn't have the html content in an HTML file as expected. Instead the attachment was an XML document with the HTML content.

Former Member
0 Kudos

Hi Meghna

I have tested Michal's blog and it worked for me.

http://scn.sap.com/community/pi-and-soa-middleware/blog/2005/11/23/xi-html-e-mails-from-the-receiver...

I was also getting the content as a xml previously because I have used the paramter as

Transform.ContentType = text/xml;charset=utf-8

As soon as I change it to text/html;charset=utf-8, the content apperead as HTML not as xml.

Former Member
0 Kudos

Hi Indrajit,

I wasn't doubting Michal! The fault was mine. I used Transform.contentType instead of Transform.ContentType and was stuck for nearly 3 days!

Regards,

Meghana Sanagaram

Former Member
0 Kudos

Hi Meghna

Can you please then marked this discussion as answered so that others can follow it.

Thx

Indrajit