private string loadEmail(string url) { string HTML = ""; try { HttpWebRequest wreq = (HttpWebRequest)HttpWebRequest.Create(@url); WebProxy rssProxy = new WebProxy("proxy.global.sonyericsson.net", 8080); rssProxy.Credentials = (System.Net.NetworkCredential)System.Net.CredentialCache.DefaultNetworkCredentials; wreq.Proxy = rssProxy; wreq.UseDefaultCredentials = true; HttpWebResponse wresp = (HttpWebResponse)wreq.GetResponse(); Stream s = wresp.GetResponseStream(); StreamReader objReader = new StreamReader(s, System.Text.Encoding.GetEncoding("GB2312")); string sLine = ""; int i = 0; while (sLine != null) { i++; sLine = objReader.ReadLine(); if (sLine != null) HTML += sLine; } } catch (Exception e) { HTML = "<p><font size='3' color='#FF0000'><b>Sorry,sever connection error </b></font>" + e.Message; } return HTML; } [WebMethod] public bool sentMail(string token, int id, string cc) { if (!Utility.CheckUserToken(token)) return false; int userid = Utility.GetUserIDFromUserToken(token); DataRow phone = DAPhone.Instance.GetObjectByID(id); string body = loadBody(Utility.GetRootUrl() + "/PhoneMailView.aspx?id=" + id); string ccmail = ""; if (!String.IsNullOrEmpty(cc.Trim())) { string url = string.Format("http://seconnect.sonyericsson.net/Employees/EmployeeProfile.aspx?accountname=CORPUSERS//{0}", cc); string addressBody = loadEmail(url); Regex regex = new Regex(" <a.+?href=/'mailto:(.+?)/'>", RegexOptions.IgnoreCase); Match match = regex.Match(addressBody); ccmail = match.Groups[1].Value.ToLower(); } string subject = string.Format("{0}'s detail and quality report", phone["Name"].ToString()); string to = DAUser.Instance.GetObjectByID(userid)["Email"].ToString(); CommonOperation.SendMail(subject, body, to, ccmail); return true; } Regex regex = new Regex(" <a.+?href=/'mailto:(.+?)/'>", RegexOptions.IgnoreCase); Match match = regex.Match(addressBody); ccmail = match.Groups[1].Value.ToLower();