0

I am sending mails from my codes, for some activities.

But some mails may fail due to some or other reason.

I am keeping details of all such failed mails in a table.

Now my plan is to periodically check that table and resend mails if the table contain failed mails.

Or in other words,I want to call a method SentFailedMails() in every 12 hours.

How can I do this is c#

My application is a WCF service,Hosted on IIS

Kuttan Sujith
  • 7,811
  • 18
  • 63
  • 92

3 Answers3

2

Create a very simple console application that do the task (move your SentFailedMails() method to this application and execute it on run).

Place the exe file for the console application in a folder of your server.

Use Windows Task Scheduler to schedule the exe file execution for every 12 hours or on any specific time.

Ppp
  • 935
  • 7
  • 12
  • Windows Task Scheduler is a ready to use thing from windows. You can set it to execute a program in specific times of the day. Non developer can use it. [link](http://www.7tutorials.com/how-create-task-basic-task-wizard) Workflow foundation is more towards developing your own scheduler. I think. – Ppp Sep 02 '15 at 11:49
0

You might want to use a scheduler like Quartz.net

tobsen
  • 5,298
  • 3
  • 32
  • 49
0

You can use a threading.timer and set it to 12:00:00 then give it your mail method to execute . Don't forget about the dispatcher to change thread though.

Augure
  • 340
  • 3
  • 12