Send Email before certain days from today's date
How can i send an email certain days from now in C# (Win Forms). Say today is January 1 2010. Now i fix an appointment with doctor on January 10 2010. But i wish that a reminder email (regarding appointment) needs to be sent 3 days before (i.e. January 7 2010). I am having an email code with me.
My requirements: Visual Studio 2005, C# (vb would also do), WinForms (Wind开发者_StackOverflow中文版ows based applications)
Please help me how to achieve this?
Let me know if anything from me is needed.
Thanks!
2 ways to do this
1 ) Write a windows service which will check the current date and the date for your appointment and trigger an email.The service should be run on the server to do this
2) Write an SQL job,which will be run on everyday at some time (ex: 2 AM ) and inside the SQL job have a stored procedure which will check the dates and call dot net managed code running in the server as a service
you either need to have the application running the entire time... or have some sort of service
you need a timer that checks the system time every couple of minutes/hours/days... and at the prescribed time run your email code.
if your app won't be running constantly you'll need a service to watch in the background unless you only want to check while the application is open.
精彩评论