-3

Hai guys,

    I ve implemented the following code in the below link:

https://blog.stackoverflow.com/2008/07/easy-background-tasks-in-aspnet/

Can i implement it for sending mails once in a day and i want to send mail at 6.00AM india time... Plz help me guys.....

Community
  • 1
  • 1
ACP
  • 34,682
  • 100
  • 231
  • 371
  • What is the nature of tasks you are looking to run? If you are looking to run IO bound tasks then you may want to check out AsyncPages in ASP.NET: http://msdn.microsoft.com/en-us/magazine/cc163725.aspx – Abhijeet Patel Oct 06 '09 at 05:01

2 Answers2

1

Personally I find that particular bit of code a ghastly hack. Anyways you can send code via your c# code using the System.Net.Mail.MailMessage class (example code in link). Just put it in the appropriate CacheExpiration method with a timeout of 60*60*24.

I'd recommend looking at some of the answers in How might I schedule a C# Windows Service to perform a task daily? for other ways of handling daily tasks.

As an aside, I can't speak for anyone else but I'm usually tempted to just skip over any question that ends in "Plz help me guys..."

Community
  • 1
  • 1
Jimmy
  • 89,068
  • 17
  • 119
  • 137
0

If you want to do that with the same concept as described in the blog , you can use the extension

http://visualstudiogallery.msdn.microsoft.com/a4a4f042-ffd3-42f2-a689-290ec13011f8

Implement the abstract class AbstractScheduledTask eg

 public class EmailTestTask : AbstractScheduledTask

then write your code inside the Execute method . you can call the static class like this to run EmailTestTask's Execute method after 10 min

ScheduleUtilityFactory.AddScheduleTaskToBatch(new EmailTestTask(DateTime.Now.AddMinutes(10), " RUN AFTER 10 MIN "));
Samuel
  • 1,295
  • 16
  • 21