我使用以下代码在win form-application(.net 4客户端配置文件)中使用Exchange服务器发送电子邮件:
public void SendEmail(string From,
string To,
string Subject,
string Body,
string AttachmentFile)
{
try
{
SmtpClient sMail = new SmtpClient("xs1.iasc.net");//exchange or smtp server goes here.
var SMTPUserInfo = new System.Net.NetworkCredential("user", "pass");
sMail.UseDefaultCredentials = false;
sMail.Credentials = SMTPUserInfo;
sMail.DeliveryMethod = SmtpDeliveryMethod.Network;
var msg = new MailMessage();
msg.BodyEncoding = System.Text.Encoding.GetEncoding("utf-8");
msg.IsBodyHtml = true;
msg.From = new MailAddress(From);
msg.To.Add(To);
msg.Subject = Subject;
msg.Body = Body;
sMail.Send(msg);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
它在Windows XP中正常工作,但是当我在Windows 7上运行时,我收到以下错误:
客户端无权向此服务器提交邮件。服务器响应为:5.7.3客户端无权向此服务器提交邮件。
任何想法?
答案 0 :(得分:0)
您的Exchange中可能阻止了Windows 7客户端的IP地址 - 在接收连接器或反垃圾邮件IP阻止列表中。
答案 1 :(得分:0)
将Local Security Setting
设置为Send LM & NTLM -use NTLMv2 session security if negotiated.
我的问题已解决:
Control Panel>All Control Panel Items>Administrative Tools>Local Security Policy>Security Settings>Local Policies>Security Options>Network Security : LAN Manager Authentication Level