Click here to Skip to main content
15,890,995 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I would like to be able to produce a c# program that I can schedule to run at a set time and for that program to read a file and based on key information schedule emails, any suggest please.

What I have tried:

nothing yet just beginning to look and trying to write a program to schedule emails for home use
Posted
Updated 3-Mar-17 0:19am

You can't "write a program to run at a specific time" - it's either running at the time, or it isn't. You can tell you operating system to run it at a specific time and (assuming the computer is powered on and working) it will do it.
For Windows, you would use the Task Scheduler: Task Scheduler (Windows)[^]

The other approach is to run the app when the computer starts via Startup, and have it check every sixty seconds or so if it is time to do something.

Either way, you need to write the code to send your emails, and tell the operating system when to run it. This may help with the email part: Sending an Email in C# with or without attachments: generic routine.[^]
 
Share this answer
 
What OG said above is correct

- but you could write a 'Win32 Service' (which is running all the time), using say 'Topshelf', and schedule your email send procedure by adding Quartz.Net to the service - that way, you can schedule (for example) by interval - 'every 15 minutes', or using 'cron' type specifications , or a mixture thereof

Thats where I'd start
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900