如何从控制台应用程序中的html邮件内容中提取文本? [英] How to extract text from html mail content in a console application?

查看:233
本文介绍了如何从控制台应用程序中的html邮件内容中提取文本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,
我用C Sharp编写了一个应用程序,它将从任何服务器上检索电子邮件.但是当我检索电子邮件时,我遇到了问题.一封电子邮件带有html代码.但是我只想打印其正文.我如何只打印电子邮件的正文(仅文本部分)?它们的任何c尖锐功能是什么吗?

Thnx

Hello Everyone,
I made a application in C sharp which will retrieve email from any server.But when i will retrieve a email i got a problem. A email is printed with its html code.But i want to print only its body.How can i print only the body of email(only text part).Is their any c sharp function??

Thnx

推荐答案

不是特别的:如果您正在接收HTML电子邮件-并且它们不必是HTML-则电子邮件正文为HTML文本. HTML可能封装了您要查找的文本,但是HTML的位置取决于发送者:它不一定只是文本,它可以是HTML中有效的任何东西-表格,图像,文本. .

您可以将电子邮件加载到WebBrowser控件中,然后从中提取文本部分吗?这不是一个很好的解决方案,但是我认为控制台电子邮件系统还是有点1990年的...
Not specifically: if you are receiving HTML emails - and they don''t have to be HTML - then the body of the email is the HTML text. Encapsulated within that HTML may be the text you are looking for, but where in the HTML will depend on the sender: it doesn''t have to be just text, it can be anything valid in HTML - tables, images, text...

You could load the email into a WebBrowser control, and extract the text portion from that? Not a nice solution, but I think a console email system is a bit 1990''s anyway...


这篇关于如何从控制台应用程序中的html邮件内容中提取文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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