如何在Pbear Html查看器组件上显示电子邮件图像? [英] How to display an email images on Pbear Html viewer component?

查看:68
本文介绍了如何在Pbear Html查看器组件上显示电子邮件图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只知道我必须将图像保存在temp文件夹中,然后在Htmlviewer上使用它们。

I just know I must save the images in a temp folder and then use them on Htmlviewer .

但是假设我们有一封包含5张图片的电子邮件,因此html查看器为图像提供了5个空框架,其中一些位于文本主体之前,其中一些位于电子邮件主体的中间,另一些位于电子邮件主体的末尾。现在,我如何定义哪个帧应包含哪个图片! ?以及如何将它们插入到HTML查看器中?!

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 )

推荐答案

使用 THtmlViewer 的好处是您不需要事先将图像保存到文件中。该组件可以在需要时通过 OnImageRequest 事件向您请求图像数据。您可以从任何可用来源提供数据。 HTML电子邮件使用 cid: URL来引用电子邮件本身中的资源,通常是附件。当组件要求您提供这样的URL时,您可以直接从 TIdMessage 中提取相应的数据。 TIdMessage 支持将电子邮件完全加载到内存中,而根本不使用任何临时文件。为此,您可以在 TIdMessage.OnCreateAttachment 事件中创建 TIdAttachmentMemory 类的实例。

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 the OnImageRequest event. You can supply the data from any source you have available. HTML emails use cid: 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 from TIdMessage directly. TIdMessage supports loading emails completely into memory without using any temp files at all. You do that by creating an instance of the TIdAttachmentMemory class in the TIdMessage.OnCreateAttachment event.

PBear几年前将 THtmlViewer 发行到公共领域,并且现在作为 Google代码。有几个可用的演示,包括一对使用Indy 9的演示。您应该能够将它们更新到XE2使用的Indy 10。

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.

这篇关于如何在Pbear Html查看器组件上显示电子邮件图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆