Thứ Ba, 31 tháng 3, 2009

Send Emails using windows services in C# .net

Windows Services and the Application Scheduler are two different ways of achieving much the same thing. I will assume that you are referring to Windows Services.

First of all there is a question of Architecture. Similar to web applications where you want a thin UI and a separate class project for all data access routines ect., you should plan on on putting all the sending logic into a class project. To aid monitoring, I suggest that you set up some parameter tables (you could use the parameter tables in http://www.CodePlex.Com/CommonParam).

In a date Parameter table, you could have rows for:

  • Heatbeat
  • Last mail sent
  • Last error detected
In a boolean parameter table, you could have
  • Mail to be sent (when false the queue is not polled)

When you have the action logic settled it is then simple to have a Windows Service trigger the action. For some examples of Windows Services, please see:

Không có nhận xét nào:

Đăng nhận xét