1. 首页
  2. 编程语言
  3. C#
  4. Exchange邮件读取

Exchange邮件读取

上传者: 2019-04-07 02:34:42上传 DLL文件 30.5KB 热度 52次
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

感谢分享,很实用

码姐姐匿名网友 2019-04-07 02:34:42

不错,帮别人下载的