How to handle mime message on vcl

I am running a small mail client build with delphi and indy 10. Some of the emails I receive are in mime or html format. With the current code, I am just copying bode.lines to memo.lines

MyMailMemo.Lines.AddStrings
(TIdMessage(Msg.Body);

      

How to copy content of mime messages?

0


source to share


1 answer


MIME encoded emails do not use the property TIdMessage.Body

. Instead, they use a property TIdMessage.MessageParts

where MIME text parts are stored as objects TIdText

and attachments are stored as TIdAttachment

-derived objects . You should look at the property TIdMessage.ContentType

to see if you are working with HTML email or MIME email. Even then, the chances are that HTML email messages are actually MIME encoded as they usually include an alternative plain text MIME part for non-HTML email readers. You can loop TIdMessage.MessageParts

to find the object TIdText

that ContentType

is HTML and then copy the content TIdText.Body

to your TMemo.



+5


source







All Articles