[英]Is it possible to send an email in vb.net without SmtpServer.Credentials = New _ and Net.NetworkCredential
[英]configuring the SmtpServer to send email
我正在尝试从我的网站发送电子邮件,该网站已从.NET 1.1升级到2.0。 1.1版将SmtpServer
设置如下:
System.Web.Mail.SmtpMail.SmtpServer = Current.Application.Item("SMTPServer")
它使用旧“ System.Web.Mail”命名空间中的SmtpMail.SmtpServer
属性。
如何在不使用旧名称空间中的任何类/属性的情况下设置SmtpServer
? 我在网上看到了几个在web.config文件中设置SmtpServer
的示例。
这是唯一的方法吗? 如何使用web.config中的应用程序设置?
使用System.Net.Mail.SmtpClient 。
您也可以选择强制设置服务器。
SmtpClient client = new SmtpClient("my.server.com")
// ...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.