Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Email receiver creates MainDocument.xml instead of mail body

Hello,

im using a JAVA-Mapping with mail package to create a mail with content and attachment.

This is my Coding.

InputStream inputstream = input.getInputPayload().getInputStream();

OutputStream outputstream = output.getOutputPayload().getOutputStream();

String mailOutput = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"

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

        + " <Subject>" + subject + "</Subject>\n"

        + " <From>" + mailFromAdress + "</From>\n"

        + " <To>" + mailToAdress + "</To>\n"

        + " <Reply_To/>\n"

        + " <Content_Type>text/plain</Content_Type>\n"

        + " <Content>MailContent</Content>\n"

        + "</ns:Mail>";

outputstream.write(mailOutput.getBytes());

byte[] bAttachment = new byte[inputstream.available()];

inputstream.read(bAttachment);

Attachment newAttachment = output.getOutputAttachments().create(attachmentname, "application/xml", bAttachment);

output.getOutputAttachments().setAttachment(newAttachment);

this is the configuration of the mail receiver.

the output is always the same.

two XML-Documents

The first with the text "MailContent".

The second with the right output as attachment.

what do i have to do to convert the MainDocument a real text in the mail body?

My result should be one mail with one attachment and a text as body. Either plain or als html.

br

Not what you were looking for? View more on this topic or Ask a question