You have to implement scheduler task for this. There are many dlls available to do this task. for example you can use Quartz.Net. First of all create a job to be executed-
public class EmailJob : IJob
{
public void Execute(IJobExecutionContext context)
{
// implement your method here
}
}
Now specify this job to the scheduler -
public class JobScheduler
{
public static void Start()
{
IScheduler scheduler = StdSchedulerFactory.GetDefaultScheduler();
scheduler.Start();
IJobDetail job = JobBuilder.Create<EmailJob>().Build();
ITrigger trigger = TriggerBuilder.Create()
.WithDailyTimeIntervalSchedule
(s =>
s.WithIntervalInHours(24)
.OnEveryDay()
.StartingDailyAt(TimeOfDay.HourAndMinuteOfDay(0, 0))
)
.Build();
scheduler.ScheduleJob(job, trigger);
}
}
Now specify JobScheduler.Start();
in Application_Start in your global.asax