/// <summary>/// 取得未读邮件信息/// </summary>/// <returns></returns> private string GetUnReadMailList(string strUserID, string strPassword)...{string url = System.Configuration.ConfigurationManager.AppSettings["ExchangeServer"];System.Net.HttpWebRequest Request;System.Net.WebResponse Response;System.Net.CredentialCache MyCredentialCache;string strRootURI = url + "/" + strUserID + "/收件箱";string strUserName = strUserID;//string strDomain = ConfigurationSettings.AppSettings["ExchangeDomain"]; string strDomain = System.Configuration.ConfigurationManager.AppSettings["Domain"];string strQuery = "";byte[] bytes = null;System.IO.Stream RequestStream = null;System.IO.Stream ResponseStream = null;XmlDocument ResponseXmlDoc = null;Epower.DevBase.Organization.SqlDAL.UserEntity user = new Epower.DevBase.Organization.SqlDAL.UserEntity(strUserID);string strEmailXml = "";try...{strQuery = "<?xml version="1.0"?><D:searchrequest xmlns:D = "DAV:" >"+ "<D:sql>SELECT "DAV:displayname","urn:schemas:mailheader:subject","// + ""urn:schemas:mailheader:approved ","// + ""urn:schemas:mailheader:comment "," + ""urn:schemas:mailheader:from","+ ""urn:schemas:mailheader:date" FROM "" + strRootURI + """+ "where "urn:schemas:httpmail:read"=false"// + "WHERE "DAV:ishidden" = false AND "DAV:isfolder" = false" + "</D:sql></D:searchrequest>";//集成验证方式下代码 Request = (System.Net.HttpWebRequest)HttpWebRequest.Create(strRootURI);Request.Timeout = 300000; //超时 5分钟 MyCredentialCache = new System.Net.CredentialCache();MyCredentialCache.Add(new System.Uri(strRootURI),"NTLM",new System.Net.NetworkCredential(strUserName, user.Password, strDomain)// );//NTLM集成windows验证 Basic 基本验证 Request.Credentials = MyCredentialCache;//Request.Credentials = CredentialCache.DefaultNetworkCredentials;// Specify the method. Request.Method = "SEARCH";// Encode the body using UTF-8. bytes = Encoding.UTF8.GetBytes((string)strQuery);// Set the content header length.. This must be// done before writing data to the request stream. Request.ContentLength = bytes.Length;// Get a reference to the request stream. RequestStream = Request.GetRequestStream();// Write the SQL query to the request stream. RequestStream.Write(bytes, 0, bytes.Length);// Close the Stream object to release the connection// for further use. RequestStream.Close();// Set the content type header. Request.ContentType = "text/xml;charset="utf-8"";// Send the SEARCH method request and get the// response from the server. Response = (HttpWebResponse)Request.GetResponse();// Get the XML response stream. ResponseStream = Response.GetResponseStream();// Create the XmlDocument object from the XML response stream. ResponseXmlDoc = new XmlDocument();ResponseXmlDoc.Load(ResponseStream);strEmailXml = ResponseXmlDoc.InnerXml;ResponseStream.Close();Response.Close();}catch (Exception e)...{// Catch any exceptions. Any error codes from the SEARCH// method request on the server will be caught here, also. return "";}return strEmailXml;}
| 自由广告区 |
![]() |
![]() |
| 分类导航 |
| 邮件新闻资讯: IT业界 | 邮件服务器 | 邮件趣闻 | 移动电邮 电子邮箱 | 反垃圾邮件|邮件客户端|网络安全 行业数据 | 邮件人物 | 网站公告 | 行业法规 网络技术: 邮件原理 | 网络协议 | 网络管理 | 传输介质 线路接入 | 路由接口 | 邮件存储 | 华为3Com CISCO技术 | 网络与服务器硬件 操作系统: Windows 9X | Linux&Uinx | Windows NT Windows Vista | FreeBSD | 其它操作系统 邮件服务器: 程序与开发 | Exchange | Qmail | Postfix Sendmail | MDaemon | Domino | Foxmail KerioMail | JavaMail | Winwebmail |James Merak&VisNetic | CMailServer | WinMail 金笛邮件系统 | 其它 | 反垃圾邮件: 综述| 客户端反垃圾邮件|服务器端反垃圾邮件 邮件客户端软件: Outlook | Foxmail | DreamMail| KooMail The bat | 雷鸟 | Eudora |Becky! |Pegasus IncrediMail |其它 电子邮箱: 个人邮箱 | 企业邮箱 |Gmail 移动电子邮件:服务器 | 客户端 | 技术前沿 邮件网络安全: 软件漏洞 | 安全知识 | 病毒公告 |防火墙 攻防技术 | 病毒查杀| ISA | 数字签名 邮件营销: Email营销 | 网络营销 | 营销技巧 |营销案例 邮件人才:招聘 | 职场 | 培训 | 指南 | 职场 解决方案: 邮件系统|反垃圾邮件 |安全 |移动电邮 |招标 产品评测: 邮件系统 |反垃圾邮件 |邮箱 |安全 |客户端 |