You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@synapse.apache.org by "Asankha C. Perera" <as...@apache.org> on 2008/11/19 10:54:39 UTC

Mail transport and multipart/mixed

Hi Andreas

In the MailTransportListener.processMail(), the code selects the primary 
part from an email which is expected to be the main body in the SOAP 
message. I think it should give preference to SOAP 1.1 or 1.2 parts over 
plain text. Also, the current implementation uses the content type of 
this primary part as the content type of the message, and thus a 
text/plain part that becomes the primary part, seems to engage the text 
builder and not the MIME builder, and thus seems to drop the 
attachments.. Have I missed something, or is this indeed a bug we need 
to fix? Do/can we have a unit test to cover this one?

asankha

-- 
Asankha C. Perera
http://adroitlogic.org

http://esbmagic.blogspot.com


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@synapse.apache.org
For additional commands, e-mail: dev-help@synapse.apache.org


Re: Mail transport and multipart/mixed

Posted by Andreas Veithen <an...@gmail.com>.
I think for this message, the expected result depends on the use case.
Probably there are valid use cases as well where one would register a
BinaryBuilder for text/csv and expect to get only the CSV part. My
proposal would be to execute the logic in getMessagePart only if there
is no message builder registered for multipart/mixed (which is the
default situation) and in the other case let the registered message
builder handle the entire message. To satisfy your use case you would
then have to create and register a new message builder for
multipart/mixed (or use the existing MIMEBuilder if that works).

Andreas

On Wed, Nov 19, 2008 at 18:53, Asankha C. Perera <as...@apache.org> wrote:
> Hi Andreas
>>
>> In case of multipart/mixed, getMessagePart looks for parts that have a
>> content type for which there is a message builder registered. It
>> selects the first one that is not text/plain, and only if there is
>> none matching these two criteria it will select the first text/plain
>> part. At least that is the intention. Maybe there is a bug in the
>> code. What is the structure of the MIME message for which you get an
>> unexpected result?
>>
>
> Its for a pure legacy message like the following.
>
> Subject: subject text
> Content-Type: multipart/mixed;
> boundary="------------050804040400010602000409"
>
> This is a multi-part message in MIME format.
> --------------050804040400010602000409
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
> Content-Transfer-Encoding: 7bit
>
> body text
>
> --------------050804040400010602000409
> Content-Type: text/csv;
> name="test.csv"
> Content-Transfer-Encoding: 8bit
> Content-Disposition: inline;
> filename="test.csv"
>
> <<some CSV data here>>
>
> --------------050804040400010602000409--
>
>
> I think in this case the SOAP body should contain the "body text" wrapped in
> a text wrapper element, and the CSV (and any other attachments) available as
> attachments of the SOAP message we build. We should also be able to support
> any attachment, irrespective of its content-type
>
> asankha
>
>> On Wed, Nov 19, 2008 at 10:54, Asankha C. Perera <as...@apache.org>
>> wrote:
>>
>>>
>>> Hi Andreas
>>>
>>> In the MailTransportListener.processMail(), the code selects the primary
>>> part from an email which is expected to be the main body in the SOAP
>>> message. I think it should give preference to SOAP 1.1 or 1.2 parts over
>>> plain text. Also, the current implementation uses the content type of
>>> this
>>> primary part as the content type of the message, and thus a text/plain
>>> part
>>> that becomes the primary part, seems to engage the text builder and not
>>> the
>>> MIME builder, and thus seems to drop the attachments.. Have I missed
>>> something, or is this indeed a bug we need to fix? Do/can we have a unit
>>> test to cover this one?
>>>
>>> asankha
>>>
>
> --
> Asankha C. Perera
> http://adroitlogic.org
>
> http://esbmagic.blogspot.com
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@synapse.apache.org
> For additional commands, e-mail: dev-help@synapse.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@synapse.apache.org
For additional commands, e-mail: dev-help@synapse.apache.org


Re: Mail transport and multipart/mixed

Posted by "Asankha C. Perera" <as...@apache.org>.
Hi Andreas
> In case of multipart/mixed, getMessagePart looks for parts that have a
> content type for which there is a message builder registered. It
> selects the first one that is not text/plain, and only if there is
> none matching these two criteria it will select the first text/plain
> part. At least that is the intention. Maybe there is a bug in the
> code. What is the structure of the MIME message for which you get an
> unexpected result?
>   
Its for a pure legacy message like the following.

Subject: subject text
Content-Type: multipart/mixed;
 boundary="------------050804040400010602000409"

This is a multi-part message in MIME format.
--------------050804040400010602000409
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

body text

--------------050804040400010602000409
Content-Type: text/csv;
 name="test.csv"
Content-Transfer-Encoding: 8bit
Content-Disposition: inline;
 filename="test.csv"

<<some CSV data here>>

--------------050804040400010602000409--


I think in this case the SOAP body should contain the "body text" 
wrapped in a text wrapper element, and the CSV (and any other 
attachments) available as attachments of the SOAP message we build. We 
should also be able to support any attachment, irrespective of its 
content-type

asankha

> On Wed, Nov 19, 2008 at 10:54, Asankha C. Perera <as...@apache.org> wrote:
>   
>> Hi Andreas
>>
>> In the MailTransportListener.processMail(), the code selects the primary
>> part from an email which is expected to be the main body in the SOAP
>> message. I think it should give preference to SOAP 1.1 or 1.2 parts over
>> plain text. Also, the current implementation uses the content type of this
>> primary part as the content type of the message, and thus a text/plain part
>> that becomes the primary part, seems to engage the text builder and not the
>> MIME builder, and thus seems to drop the attachments.. Have I missed
>> something, or is this indeed a bug we need to fix? Do/can we have a unit
>> test to cover this one?
>>
>> asankha
>>     
-- 
Asankha C. Perera
http://adroitlogic.org

http://esbmagic.blogspot.com


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@synapse.apache.org
For additional commands, e-mail: dev-help@synapse.apache.org


Re: Mail transport and multipart/mixed

Posted by Andreas Veithen <an...@gmail.com>.
In case of multipart/mixed, getMessagePart looks for parts that have a
content type for which there is a message builder registered. It
selects the first one that is not text/plain, and only if there is
none matching these two criteria it will select the first text/plain
part. At least that is the intention. Maybe there is a bug in the
code. What is the structure of the MIME message for which you get an
unexpected result?

Andreas

On Wed, Nov 19, 2008 at 10:54, Asankha C. Perera <as...@apache.org> wrote:
> Hi Andreas
>
> In the MailTransportListener.processMail(), the code selects the primary
> part from an email which is expected to be the main body in the SOAP
> message. I think it should give preference to SOAP 1.1 or 1.2 parts over
> plain text. Also, the current implementation uses the content type of this
> primary part as the content type of the message, and thus a text/plain part
> that becomes the primary part, seems to engage the text builder and not the
> MIME builder, and thus seems to drop the attachments.. Have I missed
> something, or is this indeed a bug we need to fix? Do/can we have a unit
> test to cover this one?
>
> asankha
>
> --
> Asankha C. Perera
> http://adroitlogic.org
>
> http://esbmagic.blogspot.com
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@synapse.apache.org
> For additional commands, e-mail: dev-help@synapse.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@synapse.apache.org
For additional commands, e-mail: dev-help@synapse.apache.org