如何在 Pbear Html 查看器组件上显示电子邮件图像?
我只知道我必须将图像保存在临时文件夹中,然后在 Htmlviewer 上使用它们。
但是假设我们有一封包含 5 张图片的电子邮件,因此 html 查看器为图像提供了 5 个空框架,其中一些位于文本正文之前,一些位于电子邮件正文的中间,一些位于电子邮件正文的末尾。现在我怎样才能定义哪个框架应该包含哪个图片! ?以及如何将它们插入到 Html 查看器?!
(有没有办法在内存流中完成所有工作?我的意思是不将图像保存在文件夹中)
I just know I must save the images in a temp folder and then use them on Htmlviewer .
But suppose we have an email which contains 5 pictures, so html viewer provides 5 empty frames for the images , some of them are located before the text body, some of them are at the middle and some at the end of the email body . Now How can I define which frame should contain which picture ! ? and how to insert them to the Html viewer ?!.
(is there any way to do all job in a memory stream ? I mean without saving the images in a folder )
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用
THtmlViewer
的好处是您不需要预先将图像保存到文件中。该组件可以在需要时通过OnImageRequest
事件向您请求图像数据。您可以从任何可用的来源提供数据。 HTML 电子邮件使用cid:
URL 来引用电子邮件本身内部的资源(通常是附件)。当组件要求您提供这样的 URL 时,您可以直接从TIdMessage
中提取相应的数据。TIdMessage
支持将电子邮件完全加载到内存中,而根本不使用任何临时文件。您可以通过在TIdMessage.OnCreateAttachment
事件中创建TIdAttachmentMemory
类的实例来实现此目的。PBear 几年前将
THtmlViewer
发布到公共领域,现在作为开源项目在 Google 代码。有几个可用的演示,包括几个使用 Indy 9 的演示。您应该能够将它们更新到 XE2 使用的 Indy 10。The benefit to using
THtmlViewer
is that you do not need to save the images to file beforehand. The component can request the image data from you when needed, via theOnImageRequest
event. You can supply the data from any source you have available. HTML emails usecid:
URLs to refer to resources inside the email itself, usually attachments. When the component asks you for such a URL, you can pull the coresponding data fromTIdMessage
directly.TIdMessage
supports loading emails completely into memory without using any temp files at all. You do that by creating an instance of theTIdAttachmentMemory
class in theTIdMessage.OnCreateAttachment
event.PBear released
THtmlViewer
into the public domain a few years ago and it is now being maintained as an open source project on Google Code. There are several demos available, include a couple that use Indy 9. You should be able to update them to Indy 10, which is what XE2 uses.