Im about to develop a site which will need 2 types of email function:
the first will be simple enough, just a realtime email using system.net.mail when certain conditions are met in the underlying DB. the second is to send out an email at the end of each day covering everything that happened during the day. WOuld that have to be set up as a scheduled开发者_开发知识库 task?
thanks
The first type can be done from withing asp.net but for the second type, I'd create a console based app and create a scheduled task to run it at the end of the day every day.
Create a console application that sends the e-mail. Use the windows taskscheuduler to start that console application every day at xx pm.
Rather than having a console application that is kicked off via a scheduled task, you could also write a workflow or Windows service that can manage the emailing. That provides the capability to schedule emails different times of the day for different use cases without having to worry about scheduled tasks.
精彩评论