Exchange邮件读取

时间:2017-01-02 03:18:33
【文件属性】:

文件名称:Exchange邮件读取

文件大小:31KB

文件格式:DLL

更新时间:2017-01-02 03:18:33

exchange

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; }


网友评论

  • 感谢分享,很实用
  • 不错,帮别人下载的
  • 不错,帮别人下载的