cancel
Showing results for 
Search instead for 
Did you mean: 

Sender Mail Adapter - forcing content as an attachement

Former Member
0 Kudos

Hi all,

We are using the Sender Mail Adapter to pull emails from the inboxes of some users of an exchange server. We use the Mail Package option.

We have noticed that the content of the emails are by-default added as attachments when there are no real attachments to the emails. However the content is not added as an attachment when one or more attachments are present in these emails.

Is there a way of forcing the Sender Mail Adapter to always add the content as an attachment and keeping the other attachments as well? and of course maintain the Mail Package message type as the main payload...?

Many thanks,

Aldo

Accepted Solutions (1)

Accepted Solutions (1)

stefan_grube
Active Contributor
0 Kudos

> We have noticed that the content of the emails are by-default added as attachments when there are no real attachments to the emails.

This is not done by PI. Microsoft Outlook and other mail servers create a multipart message from a simple email.

The mail adapter topic as very complex, as there are email standards in principle, but within the statndars, every email server has its own rules to handle emails.

Former Member
0 Kudos

Hi Stefan,

I believe this is done by PI - it is not the exchange server.

Please find the document "How to... use the Mail Adapter of the XI 3.0 J2EE Adapter Engine" and see the last text line at page 7.

"By default, the payload of the message is also sent as an attachment. etc etc"

Thanks,

Aldo

stefan_grube
Active Contributor
0 Kudos

Page 7 talks about receiver mail adapter, so it is not valid for this scenario.

I know this How-to Guide very well, because I have written it

What you can do: Use the TPCGateway to say the TCP/IP stream when a mail is coming in.

Then you can see how many parts the email really has:

/people/stefan.grube/blog/2007/03/29/troubleshooting-soap-http-and-mail-adapter-scenarios-with-tcpgateway

Former Member
0 Kudos

Hi Stefan,

Thanks for your reply. I am glad to hear that I am wrong again )

In your opinion is it possible to force the Outlook Exchange server to add the content attachment every time? I mean by doing some configuration on it...?

The reason why we would like to do this is because when - in the content tag of a Mail Package message - we have MIME message parts that are of content-type text/html we are having problems in decoding the html back to a readable format.

To do this we use the apache QuotedPrintableCodec Java class.

This works fine when the content type of the message is just text/plain but we get an exception when we try with text/html.

The exception we get is:

org.apache.commons.codec.DecoderException: Invalid URL encoding: not a valid digit (radix 16): 13

I don't know if this is because of the two character sets we have in the payload (utf-8 and iso-8859-1) or if it is for other reasons...

If you could help me figure out how to forward any HTML email to another system in a readable format it would be great.

Thanks for your support,

Aldo

stefan_grube
Active Contributor
0 Kudos

> The reason why we would like to do this is because when - in the content tag of a Mail Package message - we have MIME message parts that are of content-type text/html we are having problems in decoding the html back to a readable format.

In the sender mail system, the mails should be created as plain text.

Per default creates mail in RTF and changes this automatically to HTML, when the receiver is an email address.

To allow mobile applications to see the mail also, it is a multipart message, first part is a plain text, second part is HTML.

Most email clients can handle this, the just desplay the part the can. But technically it is a multipart message.

When you sent a mail with business data, usually it is generated by a business system and does not have such problems. When you test the scenario you should not use Outtlook. If you use Uotlook, create the mail as plain text.

Former Member
0 Kudos

Hi Stefan,

The problem here is that we have to retain the formatting of the emails therefore we need to use HTML.

Plain text is not sufficient. This is one of the requirements for the application we are building.

That is why I wanted to force attachments - that way we could have maintained the formatting of the text.

Any additional suggestion would be highly appreciated.

Best.

Aldo

stefan_grube
Active Contributor
0 Kudos

When you want to have a format, then why you do not use XML?

Former Member
0 Kudos

I am using the Mail Package option and I am getting the content of the emails via the XML payload.

However we have problems in decoding the HTML part of the multipart message back from quoted-printable.

stefan_grube
Active Contributor
0 Kudos

As you have only described a small technical detail of the issue, I have not got an idea what you are trying to do.

First of all it is necessary to know, what data you want and where they come from.

When you have a back end system which provides data and sends them out via email, then you have to describe clearly how the email setup should look like.

You won't have any HTML, just a simple MIME like application/xml or similar.

But if you want someone to create an email with an attachment manually, then I would recommend, not do your scenario that way, as you never can be sure, how your email would like.

Now you have HTML with quoted-printable, next time you receive RFT with base64.

You need to write an adapter module or a Java mapping with high effort.

Former Member
0 Kudos

The scenario we have is basically one where all emails coming from our customers and our internal service managers are copied into a single folder via journalling.

PI pulls these emails from this folder and passes them to a CE application.

These emails are manually created from our customers and internal staff so they can contain formatting and attachments.

We would like to be able to maintain this formatting and these attachments and send them to CE via a web-service.

We can force the Exchange server NOT to use RTF and only use plain text OR HTML with quoted-printable.

However the problem is when we try to get this HTML messages with formatting back to a readable format from quoted-printable. We get the exceptions I have mentioned above.

I hope this clarifies the problem.

I don't understand how it should be a problem to transfer an HTML message from one system to another. This should be basic functionality in my view.

stefan_grube
Active Contributor
0 Kudos

> I don't understand how it should be a problem to transfer an HTML message from one system to another. This should be basic functionality in my view.

HTML is not a standard for transfering data.

SAP PI does not support HTML at all.

If you want to support any type of incoming data, then you have to provide own Java code for interpreting the data.

Former Member
0 Kudos

I think we have found a solution for this issue.

To close down this thread, I would say that the problem we experienced was caused by multipart MIME messages that contained HTML parts encoded in quoted-printable. We could not decode these messages back to readable text.

To resolve the problem we have configured the Outlook Exchange IMAP4 server to always use HTML (only) for MIME messages. This way in PI we no longer receive content_type that is multipart/alternative but we only receive text/html.

The HTML in this case comes in a format that is perfectly readable.

Stefan - as usual - thanks very much for all your support! It was much appreciated.

Best.

Aldo

Answers (0)