System.Net.Mail.SmtpException:不允许使用邮箱名称.
使用SmtpClient发送邮件的时候,出现了如题错误。
解决方案:
将 SmtpClient.UseDefaultCredentials 属性设置为 true 。
官方文档说明:
Some SMTP servers require that the client be authenticated before the server sends e-mail on its behalf. Set this property to truewhen this SmtpClient object should, if requested by the server, authenticate using the default credentials of the currently logged on user. For client applications, this is the desired behavior in most scenarios.
Credentials information can also be specified using the application and machine configuration files. For more information, see <mailSettings> Element (Network Settings) .
If the UseDefaultCredentials property is set to false, then the value set in the Credentials property will be used for the credentials when connecting to the server. If the UseDefaultCredentials property is set to false and the Credentials property has not been set, then mail is sent to the server anonymously.
谷歌翻译:
一些SMTP服务器要求客户端在服务器代表它发送电子邮件之前进行认证。 如果此服务器请求,此SmtpClient对象应使用当前登录用户的默认凭据进行身份验证,请将此属性设置为true。 对于客户端应用程序,这是大多数情况下所需的行为。
凭证信息也可以使用应用程序和机器配置文件来指定。 有关更多信息,请参阅<mailSettings>元素(网络设置)。
如果UseDefaultCredentials属性设置为false,则在连接到服务器时,Credentials属性中设置的值将用于凭据。 如果UseDefaultCredentials属性设置为false,并且尚未设置Credentials属性,则邮件将匿名发送到服务器。
System.Net.Mail.SmtpException:不允许使用邮箱名称.的更多相关文章
- System.net.mail.smtpException;服务器提交了协议冲突 服务器响应为:
最近发邮件遇到问题. 主机godaddy 端口 25,80 都可以用 stmp服务器地址:smtpout.secureserver.net 不支持ssl 我就吧 EnableSsl 设置为false了 ...
- C# ASP.NET发送电子邮件System.Net.Mail
1.补充知识 (1)POP3和SMTP服务器是什么? 简单点来说:POP3 用于接收电子邮件 ,SMTP 用于发送电子邮件. (1)POP3具体指什么? POP3(Post Office Protoc ...
- C#中使用System.Web.Mail.MailMessage类无法CC多人的问题
从.NET 2.0 开始,引入了一个新的类,System.Net.Mail.MailMessage.该类用来取代 .NET 1.1 时代System.Web.Mail.MailMessage类.Sys ...
- C#System.Net.Mail采用简单邮件传输协议发送邮件
引用: using System.Net.Mail; public class EmailHelper { public static bool SendEmail(string title, str ...
- asp.net 发送邮件代码 System.Net.Mail
前台页面 SendEmail.aspx 代码 using System.Net.Mail;using System.Net; <h2> 发送电子邮件演示 </h2> <t ...
- 利用System.Net.Mail和多线程实现邮件发送
对于邮件发送,一般来说,程序会响应超过1秒,这样对于用户体验来说,让用户等待的时间过长,而且发送的邮件越多时间就越长,所以这里我利用了线程的来处理邮件发送这种耗时的工作,废话不多说,直接上代码 pri ...
- 利用System.Net.Mail 的SmtpClient发送邮件
原文:利用System.Net.Mail 的SmtpClient发送邮件 几个月前总结过关于Jmail发送邮件,当时用Jmail发送邮件发送速度有点慢(可能对Jmail了解不是很多).现在改为用微软提 ...
- C#使用 System.Net.Mail发送邮件功能
.NET 里包含了很多很丰富的邮件发送与接受的API在 System.Net.Mail命名空间里,使得我们开发发送和接受邮件相关功能变得简单,下面是一个简单发送邮件的功能: private void ...
- System.net.mail 使用ssl发送邮件失败
我采用了.net 的自带组件System.Net.Mail发送邮件,主要是在客户注册网站成功的时候发条欢迎邮件,最近邮件无法发送了,看了下腾讯smtp邮件配置,所有的邮件发送都换成ssl了,之前用的是 ...
随机推荐
- Deepin学习笔记
更改更新源 1)sudo vim /etc/apt/sources.list 2)sudo apt-get update 3) 镜像源 http://mirrors.aliyun.com/deepi ...
- 《嵌入式软件设计基础——基于ARM Cortex—M3》读书笔记
此书有点深,记录点自己能够看懂的. 1.内存管理一章:讲到变量的类型.生存周期.内存分配. auto static register 局部变量,全局变量 malloc free 内存碎片,消除内存池的 ...
- 洛谷P3374(线段树)(询问区间和,支持单点修改)
洛谷P3374 //询问区间和,支持单点修改 #include <cstdio> using namespace std; ; struct treetype { int l,r,sum; ...
- Python基础教程(016)--Python2和Python3的介绍
前言 Python2和Python3的区别 内容 Python3是现在和未来的主要版本 Python3没有考虑向下兼容. 官方提供了一个Python过度版本Python2.6 Python2.6及支持 ...
- error C2872: ‘ofstream’ : ambiguous symbol
转自VC错误:http://www.vcerror.com/?p=1123 问题描述: 编译时出现: error C2872: 'ofstream' : ambiguous symbol error ...
- 像这样玩C#【转】,觉得文章写的不错就转来啦!版权不在我
我们玩技术,不是被技术玩.Coding是快乐的,而非苦逼的..Net/C# 这个神器竟然天天有人吐槽.看不下去鸟. 在top10语言中,C#是最优美的语言,没有之一.在top10语言中,C#所可用的标 ...
- 杂项-网络-DNS-IP:8.8.8.8
ylbtech-杂项-网络-DNS-IP:8.8.8.8 8.8.8.8是一个IP地址,是Google提供的免费DNS服务器的IP地址,Google提供的另外一个免费DNS服务器的IP地址是:8.8. ...
- composer 国内加速,修改镜像源
为什么慢 由于默认情况下执行 composer 各种命令是去国外的 composer 官方镜像源获取需要安装的具体软件信息,所以在不使用代理.不翻墙的情况下,从国内访问国外服务器的速度相对比较慢 如何 ...
- php_openssl.dll' - 找不到指定的模块。 in Unknown on line 0
今天在windows2003配置IIS+php_openssl,php-error.log老是提示“PHPWarning:PHPStartup:Unabletoloaddynamiclibrary'C ...
- mongo 慢查询配置
我是分片部署,所以慢查询相关的配置是在启动片服务上. 执行查询命令,是在share的primary 上. 1. mongodb慢查询 配置 慢查询数据主要存储在 local库的system.pro ...