如何获取C#的开源DLL以将电子邮件下载为eml文件 [英] How can I get an open source DLL for C# to download email as a eml file

查看:107
本文介绍了如何获取C#的开源DLL以将电子邮件下载为eml文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个项目需要逐个下载所有电子邮件,并将每个电子邮件保存为.eml文件。我想要一个开源DLL来完成任务。任何人都可以说我可以在哪里获得那个开源DLL ..?

I have a project that needs to be download all emails one by one and save each one as an .eml file. I want an open source DLL to do the task. Can anyone say where I can get that open source DLL..?

推荐答案

没有下载为这样的东西。您通过HTTP下载的文件没有区别。你不需要这样的DLL(在.NET中是什么?有程序集,DLL只是其中一个可能的可执行模块的文件名的一部分)...



问题不太明确,当你标记ASP.NET时,下载的哪个部分,提供下载文件或下载代码的代码。提供在网页上下载文件的最简单方法是

There is no such thing as "download as". There is no difference what file you download via HTTP. You don't need such "DLL" (what is that in .NET? there are assemblies, and "DLL" is only a part of file name of one of possible executable modules)…

The question is not quite clear, what part of downloading do you mean when you tag ASP.NET, the code providing a file for downloading, or downloading code. The simplest way to provide a file for downloading on a Web page would be
<a href="your-email.eml">Download your e-mail file</a>



用户可以选择下载文件并使用相应文件类型的默认程序打开它,或者只是将其复制到客户端文件系统中的文件。 br />


或者,您可以通过ASP.NET页面动态生成文件(在服务器端的文件系统中没有此文件),直接写入生成内容到HTTP响应中。这里的关键是规定正确的 ContentType 。请参阅:

https ://msdn.microsoft.com/en-us/library/system.net.httpwebresponse%28v=vs.110%29.aspx

https://msdn.microsoft.com/en-us/library/system。 net.httpwebresponse.contenttype(v = vs.110).aspx



下载文件的代码可以使用<$ c $类编写c> HttpWebRequest (比简单的 HttpClient 更好)。您可以使用我的HttpDownloader并查看它是如何完成的;我在这个答案中提供了完整的源代码:如何下载文件来自互联网



此外,它允许继续下载部分下载的文件。



另见我过去的答案:

如何从Asp.net 2.0中的服务器下载文件

FTP:下载文件



我的印象是你想问别的, EML特有的东西,但我不知道它可能是什么。这不是我的错 - 你没有解释。



-SA


The user will be given choice to download the file and open it with some default program for corresponding file types, or just copy it to the file in the client-side file system.

Alternatively, you can dynamically generate a file on the fly by your ASP.NET page (without having this file in the file system on your server side), directly writing generated content into the HTTP response. The key here is to prescribe correct ContentType. Please see:
https://msdn.microsoft.com/en-us/library/system.net.httpwebresponse%28v=vs.110%29.aspx,
https://msdn.microsoft.com/en-us/library/system.net.httpwebresponse.contenttype(v=vs.110).aspx.

The code downloading the file can be written using the class HttpWebRequest (better way than simpler HttpClient). You can use my HttpDownloader and see how it is done; I provided complete source code in this answer: how to download a file from internet.

Additionally, it allows to continue downloading of partially downloaded files.

See also my past answers:
how to download a file from the server in Asp.net 2.0,
FTP: Download Files.

I have an impression that you wanted to ask something else, something specific to EML, but I have no idea what it could be. This is not my fault — you did not explain it.

—SA


这篇关于如何获取C#的开源DLL以将电子邮件下载为eml文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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