如何在 Pbear Html 查看器组件上显示电子邮件图像?

发布于 2025-01-03 01:43:36 字数 236 浏览 7 评论 0原文

我只知道我必须将图像保存在临时文件夹中,然后在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

燕归巢 2025-01-10 01:43:36

使用 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 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 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文