在 WebBrowser 控件中显示邮件消息
我正在尝试设计一个邮件系统(.NET C#)。
消息存储在数据库中的两个表中:
message(Message_id, Receiver, Sender, subject, ...) //消息的标头
message_parts(Message_id, Content_id, Part_type, Content)
因此,消息的内容分为几个部分(html 正文、纯文本正文、html 来源,附件)
我找不到一种方法,当我有嵌入图像的 html 时,如何在 WebBrowser 控件中显示消息。我将拥有通过内容 ID 引用图像的 html,我将拥有以 Base64 编码的图像。现在我如何链接它们并显示?
我想到的唯一想法是构建一个 mht 文件并在 Web 浏览器中打开它。 但除此之外,我也不知道如何做到这一点,我最不想做的就是在本地系统上创建文件。
因此,问题是:
- 如何显示如上所述分成几部分的消息?
- 如何构建包含这些部分的 mht 文件?
- 也许它不是我应该使用的 WebBrowser,而是一些对我有用的 UI 控件?
谢谢你!
I'm trying to design a mailing system (.NET C#).
Messages are stored in database in two tables:
message(Message_id, Receiver, Sender, Subject, ...) //message's header
message_parts(Message_id, Content_id, Part_type, Content)
So, the content of message is divided into parts (html body, plain text body, sources for html, attachments)
I can't find a way how could i display the message in the WebBrowser control in case when I have html with embedded images. I will have html that references images by content id, i will have images encoded in base64. Now how can I link them and display?
The only ideea that comes to me is building an mht file and open it in the WebBrowser.
But besides that i can't figure out how to do this too, the last thing i want is to create files on the local system.
So, the questions are:
- how can I display a message broken into parts as explained above?
- how to build an mht file having these parts?
- maybe it's not a WebBrowser I should use, but some UI control that does the work for me?
Thank you!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以创建 mht 文件并将 mimetype 设置为
multipart/mime
。这是一个网页,其中包含一些创建 MHT 的代码(可能依赖于您需要单独安装的 dll): http://www.eggheadcafe.com/articles/20040527.asp
也许这也可能有帮助:http://msdn.microsoft.com/en-us/library/aa488379(EXCHG.65).aspx
You could create the mht file and set the mimetype to
multipart/mime
.Here is a webpage which has some code to create MHT (possibly relying on dlls you need to install separately): http://www.eggheadcafe.com/articles/20040527.asp
Perhaps this might be helpful too: http://msdn.microsoft.com/en-us/library/aa488379(EXCHG.65).aspx