Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8973429
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T18:26:40+00:00 2026-06-15T18:26:40+00:00

There is this particular kind of Amazon message that seems to throw Indy’s MessagePart

  • 0

There is this particular kind of Amazon message that seems to throw Indy’s MessagePart parser.

The message is structured (strongly abridged version, of course) as such:

Content-Type: multipart/mixed;
       boundary="----=_Part_853547_18414509.1354745829993"

<some irrelevant header stuff>

------=_Part_853547_18414509.1354745829993
Content-Type: multipart/alternative;
       boundary="----=_Part_853548_20128671.1354745829993"

------=_Part_853548_20128671.1354745829993
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<the message in plain text>

------=_Part_853548_20128671.1354745829993
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<the message in HTML>

------=_Part_853548_20128671.1354745829993--

------=_Part_853547_18414509.1354745829993--

Now, when I perform a

imap.UIDRetrieve(UID,Msg)

then

Msg.ContentType = "multipart/mixed"

and the individual Msg.MessageParts have this as content-type:

Msg.MessageParts[0].ContentType = "multipart/alternative; boundary="----=_Part_853548_20128671.1354745829993""

Msg.MessageParts[1].ContentType = "text/plain"

No trace of the text/html part.

Would anyone have any idea what is going on here?

(am using very latest Indy build)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T18:26:41+00:00Added an answer on June 15, 2026 at 6:26 pm

    When I run that email data as-is directly through TIdMessage using the current Indy 10 SVN snapshot, it parses just fine. Three MessageParts entries are generated – multipart/alternative, text/plain, and text/html – as expected.

    In your recent post to the Embarcadero forum on this same subject, you left out a key piece of information – you are using TIdIMAP4 to retreive the emails that are failing for you. That is important because the portions of the email that you consider irrelevant must be containing data that is hitting a piece of Indy code that has a known design limitation that will not be fixed in Indy 10 (but is already marked as required for Indy 11) but which affects TIdIMAP4.

    Internally, TIdIMAP4.UIDRetreive() passes the raw downloaded email as-is to TIdMessage.LoadFromStream(). The core parser inside of TIdMessage expects the input data to be escaped using an SMTP-style dot transparency that IMAP does not actually use. TIdMessage currently does not have any way of knowing the source of the input email data, and consequently its formatting for escaped data. It is the responsibility of higher level protocol transports to parse and decode escaped data as needed, and then should pass the unescaped data to TIdMessage for further parsing. But that is not actually the case right now. That separation of logic is not in place in Indy 10 as much as it should be. TIdMessage uses direct access to the source data, which works fine in TIdSMTP and TIdPOP3 but not in TIdIMAP4.

    In the IdMessageClient.pas unit, there is a helper class named TIdIOHandlerStreamMsg that has a public EscapeLines property that was specifically designed to help address this issue in situations that need it (namely, passing un-escaped data to TIdMessage.LoadFrom...() methods). Instead of calling TIdMessage.LoadFromStream() directly, the current workaround is to instantiate a TIdMessageClient, assign a TIdIOHandlerStreamMsg to its IOHandler property, set its EscapeLines property to True, and pass it the source TStream to parse and destination TIdMessage to output to. This allows Indy to fake the escaping formatting that the core parser is expecting to unescape.

    However, TIdIMAP4 does not currently utilize this workaround yet. Now that I think about this, it should be easy to add, so I will look into it. In the meantime, you can use TIdIMAP4.RetrieveNoDecodeToStream() or TIdIMAP4.UIDRetrieveNoDecodeToStream(), which will indirectly escape the data when writing to the destination TStream (another known design limitation that needs fixing), and then you can pass that TStream to TIdMessage.LoadFromStream() to parse normally.

    Update: I have just checked in an update to the AppendMsg() and InternalRetrieve() methods of TIdIMAP4 to no longer rely on SMTP-style dot transparency. This has been on Indy’s TODO list for several years now, so it is nice to final address it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know there are a lot of posts related to this particular error but
Cascading deletes aren't setup on this particular database. Just wondering if there's a way
Is there a particular way to initialize an IList<T> ? This does not seem
There is this way, of course: OuterClass.this . But that's very clumsy. Ideally, there'd
There was this problem that has been asked about implementing a load byte into
Is there a way to find a particular kind of email address for a
There's a ton of questions about this particular exception but I couldn't find any
I'm looking for the name of a particular kind of set/map, for which there
There is this output of objdump on some object file: $ objdump -h main.o
There's this ... MSDN page, IQueryable(Of T) Interface . Can you do a better

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.