登录 注册
当前位置:主页 > 资源下载 > 50 > 阅读Exchange邮件

阅读Exchange邮件

  • 更新:2024-06-19 16:56:08
  • 大小:31KB
  • 推荐:★★★★★
  • 来源:网友上传分享
  • 类别:C# - 后端
  • 格式:DLL

资源介绍

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