we have a problem with the Mail adapter...
We try to send an email out of the XI to some service providers. The outgoing data is stored in an XML structure. This structure agrees with the conventions of the Mail Package format, which is used for dynamic Mail generation. The content of this Mail Package structure is a semicolon separated string, which should be attached as a CSV-File to the outgoing email. Up to this everything works fine. We get the email with the attachement out of the system, send it to a SMTP server and transfer it to a previous defined email address.
But when we open the attachement (with Wordpad, Excel,...) all german umlaut have been lost. The problem is, when transfering the Mail Package content into a File, this File is UTF-8 encoded.
Can anyone give us a hint how to convert the encoding of the attached file from UTF-8 to ISO-8859-1 (Latin-1)?
Actual we have set the following parameters on the module page:
1. localejbs/AF_Modules/MessageTransformBean Local Enterprise Bean XML2Plain 2. localejbs/sap.com/com.sap.aii.adapter.mail.app/XIMailAdapterBean Local Enterprise Bean mail
XML2Plain Transform.ContentDisposition attachment;filename="ABC.csv" XML2Plain Transform.ContentType text/plain;charset=latin-1 XML2Plain Transform.ContentDescription "ABC"
I hope we get some help...
When you use the mail package, you have to provide the content type information in the tag <i>Content_Type</i>.
So you have to add
to the XML.
The entry <i>Transform.ContentType</i> from the module configuration is ignored, when you use the Mail Package.
Hope that helps
thank you for your answer... I've changed the XML, but there is no change in the encoding of the attachment. It is still UTF-8.
The Payload from our Message, which you can see in the XI Monitoring (Transaction SXMB_MONI), has the following structure:
<?xml version="1.0" encoding="UTF-8" ?> <ns0:Mail xmlns:ns0="http://sap.com/xi/XI/Mail/30"> <Subject>Testmessage</Subject> <From>email@example.com</From> <To>lars.ottawa@xyz.DE</To> <Content_Type>text/plain;charset="ISO-8859-1"</Content_Type> <Content>4264673;DE;33334;Bartholomäusweg 26;Gütersloh;Lars;Ottawa;99.9;1;1;;129717</Content> </ns0:Mail>
When we try to open the attachment (with an editor) we get the following string...
It seems that the Content Type attribute has no effect. Could that be possible?
We are sure that we get a UTF-8 encoded attachment, because when we open it in an UTF-8-compatible Editor and use the UTF-8 view mode, everything looks fine...
The source of this example is a CRM 4.0 system and we are using graphical mappings (message mappings). The semicolon seperated string is created in this mapping with an advanced user defined function.
On our XI service pack 12 is installed.
Hi Stefan, nice to hear again from you (we have seen us at HUGO..)
the file adapter does the job, only the email adapter fails in encoding the message.
The email adapter should do more jobs for me as i receive messages from outlook/notes
1. Swap to the mysterious content
2. Transform it
(error described in BPM stops after receiving payloads from sender email channel)
3. Swap to attachment
4. Transform .csv-attachment with content conversion
so the encoding for the transformed message should be iso-8859-1 ?!
I doesnt matter if i use "text/plain" or "text/xml".
If i prepare the email i can skip step 1 and 2 but the result is the same.
You meant "codepage"? Is it another attribute i can set?
So you talk about mail to file.
The original post was just the other way around.
See what I have written here:
btw. interesting effect
if i add the messagetransformationbean to the fileadapter, the umlauts are not changed to utf-8 (auditlog shows the successful transformation to utf-8)?
maybe the "Transform.Class=com.sap.aii.messaging.adapter.Conversion" makes problems?
Next i will try with an already converted csv-to-xml attachment
mails with and .csv attachment should be mapped to an rfc-call
1. sender mail adapter which should convert the attachment using the contentconversion module (from you : https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/f02d12a7-0201-0010-5780-8bfc7d12f891)
So i tried to attach the already converted csv-to-xml to the email and everything works fine.
The problem is the conversion-class! It cant handle umlauts or other county specific encoding.
The content-conversion from the fileadapter works. The module in the email adapter fails.
Can you confirm this?
We handled the similar requirement in our project.
To convert the target file encoding UTF-8 to ISO-8859-1. For this i have used XSLT mapping, by changing the output encoding as shown in the code.
<?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:a="urn:abc.com:pi:ab:cd:FileToMail:Mail"> <xsl:variable name="vfileName" select="/a:MT_Mail/FileName"/> <xsl:output method="text" indent="yes" encoding="iso-8859-1" media-type="TYP"/>
also set the charset value to ISO-8859-1 as shown in the XSLT mapping
<xsl:text>----mime-boundary Content-Type: text/html; charset="ISO-8859-1" Content-Disposition: inline
In Adapter module, add XMLAnonymizerBean
Hope this will resolve your issue.
Edited by: Divya_10 on Jun 14, 2011 10:20 AM