asp.net 站点,需要计划的电子邮件任务吗?
我即将开发一个需要两种类型的电子邮件功能的网站:
第一种非常简单,只是当底层数据库满足某些条件时使用 system.net.mail 发送实时电子邮件。 第二个是在每天结束时发送一封电子邮件,涵盖当天发生的所有事情。 必须将其设置为计划任务吗?
谢谢
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
创建一个发送电子邮件的控制台应用程序。使用 Windows TaskScheduler 每天下午 xx 点启动该控制台应用程序。
Create a console application that sends the e-mail. Use the windows taskscheuduler to start that console application every day at xx pm.
您还可以编写可以管理电子邮件的工作流或 Windows 服务,而不是通过计划任务启动控制台应用程序。这提供了针对不同用例在一天中的不同时间安排电子邮件的功能,而无需担心计划任务。
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.
第一种类型可以通过 asp.net 完成,但对于第二种类型,我将创建一个基于控制台的应用程序并创建一个计划任务以在每天结束时运行它。
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.