Exchange邮件读取

上传:dwl52314 浏览: 51 推荐: 0 文件:DLL 大小:30.5KB 上传时间:2019-04-07 02:34:42 版权申诉
public int GetMailCount1(string username) { string domain = "lzlj"; string email = ""; string pwd = ""; int ecount = 0; if (!string.IsNullOrEmpty(username.Trim()) && !username.ToLower().Contains("system")) //有用户名和密码 { if (!string.IsNullOrEmpty(domain) && !string.IsNullOrEmpty(username) && !string.IsNullOrEmpty(pwd) && !string.IsNullOrEmpty(email)) { try { //ExchangeContext ctx = new ExchangeContext(ExchangeVersion.Exchange2010, "http://mail.lzlj.com", email, new System.Net.NetworkCredential(username, pwd, domain)); ExchangeContext ctx = new ExchangeContext(ExchangeVersion.Exchange2010, "http://mail.lzlj.com", "chenming1@lzlj.com", new System.Net.NetworkCredential("user", "pwd", "lzlj")); ecount = ctx.Inbox.UneadMailCount; } catch (Exception e) { ecount = -1; } } else { } } return ecount; } { if (!string.IsNullOrEmpty(domain) && !string.IsNullOrEmpty(username) && !string.IsNullOrEmpty(pwd) && !string.IsNullOrEmpty(email)) { try { //ExchangeContext ctx = new ExchangeContext(ExchangeVersion.Exchange2010, "http://mail.lzlj.com", email, new System.Net.NetworkCredential(username, pwd, domain)); ExchangeContext ctx = new ExchangeContext(ExchangeVersion.Exchange2010, "http://mail.lzlj.com", "chenming1@lzlj.com", new System.Net.NetworkCredential("user", "pwd", "lzlj")); ecount = ctx.Inbox.UneadMailCount; } catch (Exception e) { ecount = -1; } } else { } } return ecount; }
上传资源
用户评论

梦在天涯爱在海角 2019-04-07 02:34:42

感谢分享,很实用

clause_4376 2019-04-07 02:34:42

不错,帮别人下载的

madigua79892 2019-04-07 02:34:42

不错,帮别人下载的