VB.net 发送预定电子邮件提醒的最佳技术是什么?
我已经思考这个问题有一段时间了,但我仍然不确定最好的方法是什么。
基本上,我在数据库中存储了数百个电子邮件地址,每周我都会自动向这些地址发送信息公告。我已经通过 DB (Oracle) 上的存储过程和计划作业完成了此任务,但我确信通过某些 VB.net 解决方案可以更好地实现此目标。
我读过有关人们编写 Windows 服务、创建控制台应用程序和使用 Windows 调度程序的信息。我倾向于使用 Windows 服务方法,但我不确定如何告诉该服务在每周的特定时间发送电子邮件。有什么想法,或者有更好的方法吗?
另外,什么最好呢?向电子邮件列表中的地址发送单独的电子邮件,还是发送一封将每个地址添加为密件抄送的电子邮件?
谢谢
I've been thinking about this problem for a while now and I'm still not sure what is the best approach.
Basically I've got several hundred email addresses stored in a Database, and every week I would like to automatically send these addresses a bulletin of information. I've accomplished this with a Stored Procedure and a Scheduled Job on the DB (Oracle), but I'm sure this could be achieved better with some VB.net solution.
I've read about people writing a Windows Service, or creating a Console Application and using Windows scheduler. I'm swaying to wards the Windows Service approach but I'm not sure how to tell the service to send emails at a specific time every week. Any ideas, or is there a better approach?
Also, what would be best? Send individual emails to the addresses in the emailing list, or send one email with every address added as a BCC?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这种类型的事情是计划任务的设计目的之一。想象一下,创建一个占用内存的服务,该服务在 7 天内什么都不做,只运行 4 分钟。然后又是7天的等待。虽然它可能有效,但这肯定不是服务的用途。
使用计划任务。该计划任务可以轻松启动一个控制台应用程序,该应用程序读取数据库,发送电子邮件,然后正常退出。使用计划任务来执行...按计划执行任务并没有什么问题。
至于什么是“最好”,没有“最好”。只适合您的情况。您想要发送 150 封电子邮件,以便每个人都可以在上面看到自己的名字,还是发送一封包含 150 个密件抄送的电子邮件,而没有人在上面看到自己的名字?只要按照你想要的方式工作就是“最好的”
This type of thing is one of the things that scheduled tasks are designed for. Imagine creating a service that sits there taking up memory doing absolutely nothing for 7 days, only to run for 4 minutes. Then another 7 days of waiting. While it may work, its certainly not what a service is for.
Use a scheduled task. That scheduled task could easily just start a console app which reads the database, sends the emails, and then quits as normal. Nothing wrong with using a scheduled task for something that... performs a task on a scheduled basis.
As for what is "best", there is no "best". Just what works for your situation. Do you want to send out 150 emails, so that each person sees their name on it, or send out one email with 150 BCCs, where no on sees their name on it? Whatever works the way you want it to is "best"
您是否考虑过使用控制面板中的“计划任务”功能?这就是我用于重复使用程序的方法,与您所描述的类似。
Have you considered using the "scheduled tasks" feature in the control panel? That's what I use for recurring program usage similar to what you've described.