我整天都在研究,真是机智!我只是无法让我的smtp服务器与Windows用户进行身份验证-我在做什么错?我不断收到错误:
SMTP服务器需要安全连接,或者客户端未通过身份验证。服务器响应为:5.7.3客户端未通过身份验证
我的smtp设置为在访问选项卡中将“身份验证”设置为“集成Windows身份验证”:
并且我的中继限制设置为仅以下列表,并且我已经将127.0.0.1添加到该列表中。我也选中了“允许所有通过身份验证的计算机进行中继”复选框,而不管上面的列表如何:
其他所有内容仍设置为默认值。我的代码说:
var objMessage = new MailMessage("[email protected]", "[email protected]");
// format subject and message
objMessage.Subject = "testing email";
objMessage.Body = "blah blah";
using (var client = new SmtpClient())
{
client.Host = "127.0.0.1";
client.Port = 25;
client.UseDefaultCredentials = false;
client.Credentials = new System.Net.NetworkCredential("SMTPuser", "mypassword");
client.Send(objMessage);
}
我已经在计算机上使用匹配的密码创建了一个标准的Windows用户SMTPuser。我很困惑。Windows身份验证应该如何工作?我弄错了什么假设?为什么我所有的安全级别都设置为“匿名”时才能够发送?
All I want to do is send mail to any domain (I don't need to receive mail), and obviously protect my server from spammers using it to send out their spam. For now, the only legitimate access should be coming from localhost. From the research that I did, it seems like I could accomplish what I want by setting everything to anonymous, but then limiting the connections to 127.0.0.1 and the relay restrictions to 127.0.0.1 - is that right? I'm on the verge of resorting to that, but I'd really like to understand how this works especially in the case where I might want to remotely access the smtp server one day.
Am I way off base to think I could set up a server that would allow anybody who can authenticate with my SMTPuser Windows login to be able to use my smtp server to send email to any domain?
您应该在SMTP服务中启用基本身份验证,因为SmtpClient类不使用集成Windows身份验证。
将访问SMTP服务限制为仅127.0.0.1就足够了,因为这将有效地阻止任何人从外部使用该服务。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句