今天同事分享了一個方式可以取代之前的方式來取得郵件的內容
利用System.Net.WebRequest可以直接抓取已執行過的.net頁面資料的html
這樣子一來就可以直接發送了,就不需要開啟檔案再將字串取代了
System.Net.WebRequest request = System.Net.WebRequest.Create(epaperPage + "?id=" + param_mailid);
System.Net.WebResponse response = request.GetResponse();
string contents;
using (StreamReader reader = new StreamReader(response.GetResponseStream()))
{
contents = reader.ReadToEnd();
reader.Close();
}
response.Close();
沒有留言:
張貼留言