问题描述
从我的应用程序连接到托管的Exchange服务器时遇到了很多麻烦。我试图对需要NTLM身份验证的服务器使用System.Net.Mail。我一直在通过铃声试图解决这个问题并且看到了关于这是否可能的相反陈述。我读过的一些评论建议我需要回到System.Mail ...但我需要HTML电子邮件,所以不要相信这是一个选项。
I am having a ton of trouble connecting to a hosted Exchange server from my app. I am trying to use System.Net.Mail against a server that requires NTLM authentication. I have been through the ringer trying to work this out and have seen contrary statements about whether this is or is not possible. Some comments I have read suggest I need to move back to System.Mail... but I need HTML eMails so don't believe that's an option.
当我连接而未指定NTLM作为身份验证方法时,我收到"身份验证失败"。响应,这似乎是合理的,因为我的服务提供商告诉我他们期望NTLM身份验证。但是,当我切换到NTLM时,我收到错误,表明服务器没有响应(这看起来很奇怪)。
When I connect without specifying NTLM as the authentication method I received "authentication failed" responses, which seems reasonable since my service provider tells me they expect NTLM authentication. However, when I switch to NTLM I receive errors suggesting the server did not respond (which seems weird).
谁能告诉我这是否是一个我应该能够工作的场景?我正在运行Vista,将.Net Framework 3.0与Exchange 2007服务器连接起来。这是我的代码(至少是最新的迭代!)...
Can anyone tell me whether this is a scenario I should be able to get working? I am running from Vista, with .Net Framework 3.0 against an Exchange 2007 server. Here is my code (at least the latest iteration!)...
System.Net.NetworkCredential credentials = new System.Net.NetworkCredential(user_id,user_password);
SmtpClient smtp = new SmtpClient(" smtp.ihostexchange.net");
smtp.UseDefaultCredentials = false;
smtp.Credentials =(System。 Net.ICredentialsByHost)credentials.GetCredential(" smtp.ihostexchange.net",587," NTLM");
smtp.EnableSsl = true;
smtp.Send(message);
System.Net.NetworkCredential credentials = new System.Net.NetworkCredential(user_id, user_password);
SmtpClient smtp = new SmtpClient("smtp.ihostexchange.net");
smtp.UseDefaultCredentials = false;
smtp.Credentials = (System.Net.ICredentialsByHost)credentials.GetCredential("smtp.ihostexchange.net", 587, "NTLM");
smtp.EnableSsl = true;
smtp.Send(message);
谢谢。
标记
推荐答案
请告诉我你的意见。
Let me know your input on this.
Hope this helps.
这篇关于Exchange 2007和SSL身份验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!