:doodle{ @size: 100vm 98vmin; } position: fixed; top: @r(1%, 100%); left: @r(1%, 100%); width: 2px; height: 2px; background: #04033e; border-radius: 50%; z-index:-999; background: hsl(@r(90, 120, 3), @r(90%, 100%), @r(30%, 40%)); zoom: @rn(.1, 5, 3); transform: rotate(@r(360deg)) translate(@r(-50, 50)vmin, @r(-50, 50)vmin); animation: move @r(20, 40)s infinite @r(-10, 0)s @p(linear, ease-in, ease-in-out) alternate; box-shadow: 0 0 1px hsl(@r(90, 120, 3), @r(90%, 100%), @r(30%, 40%)), 0 0 3px hsl(@r(90, 120, 3), @r(90%, 100%), @r(30%, 40%)); @keyframes move { 0% { transform: rotate(0) translate(0, 0); } 100% { transform: rotate(720) translate(-90, -90); } } @keyframes starMove{ from { } to { } } @keyframes weiba{ 100%{ box-shadow: 0 0 100px #fff, 0 0 300px #fff; } }

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属性,则邮件将匿名发送到服务器。

 

官方文档:https://docs.microsoft.com/zh-cn/dotnet/api/system.net.mail.smtpclient.usedefaultcredentials?view=netframework-4.7.1

 

posted @ 2018-01-02 15:15  不拖延从明天开始  阅读(2661)  评论(0编辑  收藏  举报
xxxx