Delphi program reading email with TIDMessage component, problem with the body

I use a TIDMessage component (M) to read emails in a Delphi application
Sometime I get as unique first line of the body (M.Body[0]) this : "This is a multipart message in MIME format"
Where can I get the real body of this message ?
Thanks !
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Sinisa VukSoftware architectCommented:
Read more information about how multipart messages ... There is similar question on EE too.
Iterate through M.MessageParts[x] and check ContentType  - depending on content type - use different read method.
If it is plain text then use TIdText(M.MessageParts.Items[idx]).Body but if it is mime encoded - then use Indy functions for Base64/Mine decoding.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
LeTayAuthor Commented:
I am a little bit lost with all these sub-components etc...
The originator of the message is an Outlook client
From that client, I send a one line of test body message
Can you provide a sample of Delphi code to get the simple message string ?
LeTayAuthor Commented:
Sorry Sinisa, I understood finally the code you posted in your first answer
It works fine !
Many thanks
Sinisa VukSoftware architectCommented:
One more example to study if you need...
LeTayAuthor Commented:
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.