日期:2014-05-18  浏览次数:20528 次

如何定期发送邮件
用什么方式可以定期给到期用户发送提醒邮件。

------解决方案--------------------
webservice..

AJAX组件中的Timer

或者可以写个控制台应用程序

服务器如果是SERVER2003的话
使用自带的任务计划,规定什么时候执行一次

执行的就是查询哪些用户到期了,发送邮件

方法很多种的
------解决方案--------------------
http://topic.csdn.net/u/20080702/09/c9dc99a1-3649-4677-a4ad-3bcdcb978fd5.html

Run a thread
C# code

bool mailThreadStarted = false;

protected virtual void Application_Start(object sender, EventArgs e)
{
   Application.Lock();

   if(!mailThreadStarted)
   {
    Thread th = new Thread(SendEmailWorker);
        th.IsBackground = true;
        th.Start();
        mailThreadStarted = true;
   }

   Application.UnLock();
}

private void SendEmailWorker()
{
  while(true)
  {
    ..sending email code
    Thread.Sleep(...);
  }
}

------解决方案--------------------
探讨
http://topic.csdn.net/u/20080702/09/c9dc99a1-3649-4677-a4ad-3bcdcb978fd5.html

Run a thread

C# code
bool mailThreadStarted = false;

protected virtual void Application_Start(object sender, EventArgs e)
{
Application.Lock();

if(!mailThreadStarted)
{
Thread th = new Thread(SendEmailWorker);
th.IsBackground = true;
th.Start();
mailThreadStart…