羣發郵件我呼籲線程母版頁頁面加載,並呼籲電子郵件功能,併爲:發送背景
Page_load()
{
CreatingThread();
}
protected void CreatingThread()
{
Thread tSendMails;
tSendMails = new System.Threading.Thread(delegate() { EmailQueueSettings(); });
tSendMails.IsBackground = true;
tSendMails.Start();
}
protected void EmailQueueSettings()
{
// Function to get emails which are not sent ;
// looping it and sending it one by one
// Function to send mails
// Updating the status after mail is sent
}
郵件會但同一用戶多次的郵件發送給他們。
當下一次加載頁面時是否可以分配不同的線程和不同的郵件?
重新閱讀你的文章並修改 – 2013-02-07 12:52:17
你爲什麼要把它放在你的母版頁的Page_Load中,你是否希望每當有人打電話給使用母版頁的頁面時,它都會嘗試發送這些電子郵件? – Tanner
我會使用Visual Studio調試器來找出爲什麼你多次發送電子郵件到同一個地址。 –