C#使用.net.mail配置163邮箱报错:不允许使用邮箱名称。 服务器响应为:authentication is required,smtp9,DcCowABHK4UYE11W2k6fAQ--.52196S2 1448940312

时间:2015-12-01 14:23:12   收藏:0   阅读:3128

client.UseDefaultCredentials = true;

要放在

client.Credentials = new NetworkCredential("用户名", "密码");

的前面

var client = new SmtpClient()
{
UseDefaultCredentials = true,
Credentials = cre,
Host = CONSTANT.Host,
Port = CONSTANT.Port,
EnableSsl = false,
DeliveryMethod = SmtpDeliveryMethod.Network
};

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!