如何在Web.config中启用SSL SmtpClient如何在、Web、config、SSL

2023-09-02 10:38:15 作者:最暖的伴

有没有办法从web.config中设置EnableSSL?

Is there a way to set the EnableSSL from the web.config?

我可以设置该属性在code,但不会为使用默认的SMTP服务器的简单邮件Web事件和其他类的工作。任何想法?

I could set this property in code, but that wouldn't work for the Simple Mail Web Event and other classes that uses the default Smtp Server. Any ideas?

推荐答案

有关.NET 3和更早版本:不能。你必须用手工来管理它。

For .NET 3 and earlier: You can't. You have to manage it by hand.

有关更多信息,你可以看到http://robertseder.spaces.live.com/blog/cns!587F478B9240C01E!270.entry.

For more information you can see http://robertseder.spaces.live.com/blog/cns!587F478B9240C01E!270.entry.

有关.NET 4:可以。

For .NET 4: You can.

请参阅http://theoldsewingfactory.com/2011/01/06/enable-ssl-in-web-config-for-smtpclient/