Reputation: 790
I have an ASP.NET Webform application (C#) configured in an IIS server. The application connects to a database on another server for its normal operation.
Now I need to create an auto emailing system. This system should check certain conditions in the database, and based on that it should send automatic emails to certain email ids. I have an smtp mail server, and I know how to do the automatic emailing using C#.
This emailing should be triggered daily at a certain time. So how will I configure such a job in my server? What are my options?
I am pretty new to the ASP world. Thanks for help.
Upvotes: 0
Views: 2874
Reputation: 91
Try exploring Scheduled Tasks in window server. You can write a console application in c# and then point your schedule task to run the console application at a certain time.
If you really want to use asp.net website then you can write a powershell script to call the asp.net web service and use schedule task to run the script at a certain time.
Upvotes: 0
Reputation: 1809
If your want to keep the logic and code of your mailing system separated from your other application, you could also generate a separate project (a C#.net console application which generates a .exe file), and launch it at your desired time intervals using Windows Task Scheduler.
Upvotes: 0
Reputation: 879
I would use Hangfire and create a recurring job(cron job) to check the db if the mails need to be sent... if so, en queue Hangfire jobs for each mail that needs to be sent. It works extremely well, I have implemented this in the past.
If you decide to go this route, let me know if you need some help.
Upvotes: 2