Mega Search
23.2 Million


Sign Up

Make a donation  
TIdMessage decoding issue [Edit]  
News Group: embarcadero.public.cppbuilder.internet.socket

This message will not decode properly in TIdMessage:

{code}
MIME-Version: 1.0
Content-Type: multipart/alternative; boundary="--523b7f5a74f77-MultiPart-Mime-Boundary"
Content-Transfer-Encoding: quoted-printable

This is a multipart message in MIME format.

----523b7f5a74f77-MultiPart-Mime-Boundary
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

PART1

----523b7f5a74f77-MultiPart-Mime-Boundary
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

PART2

----523b7f5a74f77-MultiPart-Mime-Boundary--
{code}

TIdMsg->MessageParts->Count returns 1 part ("This is a multipart message in MIME format." part)

However if I remove Content-Transfer-Encoding from the header it will:

{code}
MIME-Version: 1.0
Content-Type: multipart/alternative; boundary="--523b7f5a74f77-MultiPart-Mime-Boundary"

This is a multipart message in MIME format.

----523b7f5a74f77-MultiPart-Mime-Boundary
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

PART1

----523b7f5a74f77-MultiPart-Mime-Boundary
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

PART2

----523b7f5a74f77-MultiPart-Mime-Boundary--
{code}

TIdMsg->MessageParts->Count now returns 2 parts as it should (text and HTML).

It used to work in the previous version of Indy (cannot tell which one though).

The above was tested with latest Indy (5231).

Vote for best question.
Score: 0  # Vote:  0
Date Posted: 26-Dec-2014, at 1:24 PM EST
From: John May
 
Re: TIdMessage decoding issue [Edit]  
News Group: embarcadero.public.cppbuilder.internet.socket
Thank you for addressing this! The messages in question now indeed decode well just like in various email programs.

Vote for best answer.
Score: 0  # Vote:  0
Date Posted: 27-Dec-2014, at 7:04 AM EST
From: John May
 
Re: TIdMessage decoding issue [Edit]  
News Group: embarcadero.public.cppbuilder.internet.socket
John wrote:

> This message will not decode properly in TIdMessage:

Correct, because it is malformed, per RFC 2045 Section 6.4:

{quote}
If an entity is of type "multipart" the Content-Transfer-Encoding is not 
permitted to have any value other than "7bit", "8bit" or "binary".
{quote}

And:

{quote}
Any entity with an unrecognized Content-Transfer-Encoding must be treated 
as if it has a Content-Type of "application/octet-stream", regardless of 
what the Content-Type header field actually says.
{quote}

> However if I remove Content-Transfer-Encoding from the header it will:

Correct.  And the MIME spec is clear about being careful with the "Content-Transfer-Encoding" 
header, especially in relation to "multipart" entities.  A "Content-Transfer-Encoding" 
applies to an entity's entire content - including nested "multipart" entities.

> It used to work in the previous version of Indy (cannot tell which
> one though).

The logic was changed earlier this year in SVN revision 5128, in response 
to another email that was similarly malformed.  I have just now checked in 
some additional changes.

--
Remy Lebeau (TeamB)

Vote for best answer.
Score: 0  # Vote:  0
Date Posted: 26-Dec-2014, at 4:51 PM EST
From: Remy Lebeau (TeamB)