0

我使用 delphi 和 indy 10 运行一个小型电子邮件客户端构建。我收到的一些邮件具有 mime 格式或 html 格式。使用当前代码,我只需将 bode.lines 复制到 memo.lines

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

如何复制 mime 电子邮件的内容?

4

1 回答 1

5

MIME-encoded emails do not use the TIdMessage.Body property. They use the TIdMessage.MessageParts property instead, where textual MIME parts are stored as TIdText objects and attachments are stored as TIdAttachment-derived objects. You have to look at the TIdMessage.ContentType property to know whether you are working with an HTML email or a MIME email. Even then, chances are that HTML emails are actually MIME encoded, as they usually include an alternative plain-text MIME part for non-HTML email readers. You can loop through the TIdMessage.MessageParts looking for a TIdText object whose ContentType is HTML, then copy the TIdText.Body content into your TMemo.

于 2013-02-02T10:35:15.747 回答