Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Hai Guys, My application deals scheduled mail concept (i.e) every morning 6.00 am my users gets a remainder mail about their activities for the day... I dont know how to do this.... Many told use windows service but i will host my website on a shared server i may not get rights to do windows service... Is there any dll for sending mails at a schduled time through asp.net application ..please help me out guys......

share|improve this question

4 Answers 4

I am not sure if you are able to or not, considering the hosting environments, but it would definitely be worth your while to look into Quartz.NET for this sort of thing. You create a job, and schedule it to run at 6:00 AM every morning. It's a rather impressive tool, all-in-all.

share|improve this answer

We just set up a cache object that expires every 24 hours. Initialize it in global.asax You can set the callback method to do your batch processing. Make sure when it's done, it re-fills the cache up with the dummy object that will call the callback again in another 24 hours.

share|improve this answer
    
This will work as long as your AppPool (IIS worker process) doesn't recycle during that 24-hr time period. –  Craig Jun 4 '10 at 11:29

There are some solutions but they are all far from being ideal for your situation (because you want this on a shared host). I highly recommend you change to virtual hosting if possible, so that you can use Windows Scheduler. There are hosts that offer very cheap virtual hosting plans (starting from $40).

If this not possible, you can use a background thread as suggested in the previous answer. You may also call a page periodically on your website, for example using a website monitoring service. Both solutions are not really reliable but I'm afraid you don't have many options with a shared host.

Edit: I believe some shared hosts offer you scheduled tasks in their control panel, I remember I saw this with some host some time ago. Well, in this case you can find a host that offers this service and the problem is solved, it shouldn't be very hard with a little searching.

share|improve this answer

ASP.NET doesn't have a built in scheduler, but there are ways of starting background threads even in a web application. However my advice would be to keep it simple, and have the emailer web page send emails on demand. Then you can schedule a task from any computer to visit that web page. You might want to protect the mailer application with some form of authentication to avoid abuse of the system where hackers could invoke the emailer.

This has the added side effect (advantage) that the scheduled task is always run in your time zone.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.