我在页面加载时调用了母版页中的线程并调用了电子邮件函数,如下所示:
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
}
邮件将多次发送给同一用户,但邮件会多次发送给他们。
下次加载页面时是否可以分配不同的线程和不同的邮件?