c# - SmtpClient 类未从 Web.Config 文件中获取默认参数

标签 c# .net asp.net-mvc smtpclient

配置文件:

<system.net>
<mailSettings>
<smtp from="YYYYY@xxxxxx.com">
<network
host="mail.xxxxxx.com"
port="25"
password="password"
userName="user@xxxxxx.com"
defaultCredentials="false"
/>
</smtp>
</mailSettings>
</system.net>

我已经尝试过 defaultCredentials="true"但我收到了以下消息:

System.FormatException:Smtp 服务器返回无效响应。

如何解决这个问题?

最佳答案

将 smtp 元素的 deliveryMethod 属性设置为“network”。

关于c# - SmtpClient 类未从 Web.Config 文件中获取默认参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/329411/

相关文章:

javascript - 使用 sammy.js 重新加载页面

c# - 我可以将自定义 JsonSerializer 设置为 RestSharp RestClient

c# - C# 用户控件中的图形问题 - 调整大小会遮挡组件

c# - ASP.NET MVC 设计问题 将特定用户/"access level"代码放在哪里

.net - 获取VB.NET中的程序路径?

c# - 插件中的 ASP .NET Core MVC 2.1 mvc View

asp.net-mvc - 如何在不重复代码的情况下实现业务和 View 验证?

c# - .Net Framework 4.5 AddObject() 没有出现

c# - 如何将嵌套的三元运算符转换为嵌套的 if-else 语句?

c# - 如何在 AvalonEdit 中以编程方式设置代码选择?