Hy,
I have a c# program that sends emails with GMail SMTP server and I want to make a service or something running behind that sends this emails every 5 minutes.
Does anyone have any idea how can I make this with c# and asp.net?
Hy,
I have a c# program that sends emails with GMail SMTP server and I want to make a service or something running behind that sends this emails every 5 minutes.
Does anyone have any idea how can I make this with c# and asp.net?
You may want to look at Quartz.NET - a scheduler for the .NET platform to schedule jobs that send emails through Quartz at regular intervals.
Websites should be stateless, so implementing a continuous process in ASP.NET is a bad idea. You either need a console app that never quits, or a windows service. An even easier way is to use a scheduler and run a console app. The windows scheduler should be enough to do this.
Two options that spring to mind:
Write a Windows service. Kick off a timer that triggers every five minutes, and do your work there.
Set up a Windows scheduled task ("Task Scheduler" in Vista/Win7) to trigger every five minutes and launch your application.
I'd tend towards the latter. Windows services are easy to set up, but nothing's simpler than no code at all.