VB.net What's the Best Technique for sending scheduled email reminders?
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 (O开发者_高级运维racle), 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
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.
精彩评论