.net:System.Web.Mail 与 System.Net.Mail

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/64599/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-03 09:51:26  来源:igfitidea点击:

.net: System.Web.Mail vs System.Net.Mail

.net.net-2.0

提问by Dana

I am considering converting a project that I've inherited from .net 1.1 to .net 2.0. The main warning I'm concerned about is that it wants me to switch from System.Web.Mailto using System.Net.Mail.

我正在考虑将我从 .net 1.1 继承的项目转换为 .net 2.0。我担心的主要警告是它希望我从System.Web.Mail使用System.Net.Mail.

I'm not ready to re-write all the components using the obsolete System.Web.Mail, so I'm curious to hear if any community members have had problems using it under .net 2.0?

我还没有准备好使用 obsolete 重新编写所有组件System.Web.Mail,所以我很想知道是否有社区成员在 .net 2.0 下使用它时遇到问题?

回答by Curt Hagenlocher

System.Web.Mail is not a full .NET native implementation of the SMTP protocol. Instead, it uses the pre-existing COM functionality in CDONTS. System.Net.Mail, in contrast, is a fully managed implementation of an SMTP client.

System.Web.Mail 不是 SMTP 协议的完整 .NET 本机实现。相反,它使用 CDONTS 中预先存在的 COM 功能。相比之下,System.Net.Mail 是 SMTP 客户端的完全托管实现。

I've had far fewer problems with System.Net.Mail as it avoids COM hell.

我在 System.Net.Mail 上遇到的问题要少得多,因为它避免了 COM 地狱。

回答by Travis Heseman

Biggest issue with System.Net.Mail is that it has no support for Implicit SSL. Use System.Web.Mail until you don't have a need for Implicit SSL support.

System.Net.Mail 的最大问题是它不支持隐式 SSL。使用 System.Web.Mail 直到您不需要隐式 SSL 支持。

回答by quimbo

here are 2 sites that provide documentation and samples for both

这里有 2 个站点,为两者提供文档和示例

http://www.systemwebmail.com/

http://www.systemwebmail.com/

http://www.systemnetmail.com/

http://www.systemnetmail.com/

回答by Jeremy

The few times I ran into this, I found that that the methods and properties were all almost identical- changing the object type was just about all I had to do. There were one or two other little things, but they showed up with the lines and it was obvious what to do with Intellisense. I'd vote for going with the fully managed solution, get away from cdonts as soon as possible. It's not even installed on 03 server and newer.

有几次我遇到这种情况,我发现方法和属性几乎都是相同的——改变对象类型几乎就是我要做的所有事情。还有一两个其他的小东西,但它们出现在线条中,很明显可以用 Intellisense 做什么。我会投票支持完全托管的解决方案,尽快摆脱 cdont。它甚至没有安装在 03 和更新的服务器上。

回答by Mike L

System.Web.Mail is deprecated, but should still work. You'll be annoyed with warnings about it being obsolete, but the functionality still carries on... for the time being.

System.Web.Mail 已弃用,但仍可使用。您会对有关它已过时的警告感到恼火,但该功能仍在继续......暂时。

I would agree with others that the conversion to System.Net.Mail was very trivial. I doubt you'd have to re-write more than a line or two.

我同意其他人的观点,即转换为 System.Net.Mail 非常简单。我怀疑你必须重写超过一两行。

回答by Esteban Araya

Yes, we had the same issue, and we decided not to upgrade either. We haven't seen any problems, so you're OK ignoring the warnings.

是的,我们遇到了同样的问题,我们决定也不升级。我们没有看到任何问题,所以你可以忽略警告。

回答by Grace

We had implemented .netmail it was working at the beginning now is requiring username and password. So we went back to webmail as is working OK.

我们已经实现了 .netmail 它在开始时工作现在需要用户名和密码。所以我们回到 webmail,因为它工作正常。