如何处理发送给vcl的mime电子邮件

编程入门 行业动态 更新时间:2024-10-21 19:08:01
本文介绍了如何处理发送给vcl的mime电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

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

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?

推荐答案

MIME编码的电子邮件不使用 TIdMessage.Body 属性.他们改用 TIdMessage.MessageParts 属性,其中文本MIME部分存储为 TIdText 对象,附件存储为源自 TIdAttachment 的对象.您必须查看 TIdMessage.ContentType 属性,以了解您使用的是HTML电子邮件还是MIME电子邮件.即使那样,HTML电子邮件实际上仍可能是MIME编码的,因为它们通常包括非HTML电子邮件阅读器的替代纯文本MIME部分.您可以遍历 TIdMessage.MessageParts ,查找 ContentType 为HTML的 TIdText 对象,然后复制 TIdText.Body 内容添加到您的TMemo中.

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.

更多推荐

如何处理发送给vcl的mime电子邮件

本文发布于:2023-10-12 23:35:33,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1486204.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:如何处理   发送给   电子邮件   vcl   mime

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!