how to process a mime email to vcl

偶尔善良 提交于 2019-12-13 06:59:13

问题


I run a small e mail client build with delphi and indy 10. Some mails i receive have the mime format or html format. With the current code I just copy the bode.lines to a memo.lines

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

How do I copy the content of mime emails?


回答1:


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.



来源:https://stackoverflow.com/questions/14660784/how-to-process-a-mime-email-to-vcl

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!