Hi I want to send a mail every 5 mins using schedulers in c#,but I don't want to use windows service.how to send a mail every 5 minits. pleae anyone help me.
Asked
Active
Viewed 541 times
-2
-
1give hangfire a look. http://hangfire.io/ – Darren Kopp Sep 16 '15 at 06:51
-
You can use timer to do this. – Sabyasachi Mishra Sep 16 '15 at 06:53
-
@Sabyasachi Mishra please give me any sample code – Anil Kumar Sep 16 '15 at 06:55
-
@Anit: Create an console application (.exe) and Configure it with windows task scheduler. – Suprabhat Biswal Sep 16 '15 at 07:05
-
I suggest you check http://www.quartz-scheduler.net/ – SmartDev Sep 16 '15 at 07:09
-
This is basically a duplicate of http://stackoverflow.com/questions/246697/best-timer-for-using-in-a-windows-service – Patrick Sep 16 '15 at 07:23
2 Answers
2
We obviously are not going to write code for you, but please have a look at this suggestion:
- Write your Console Application that sends Emails.
- For this have a look at the classes SmtpClient and MailMessage
You can also configure Log4Net with an EmailAppender to send Mails
Schedule a Task in "Windows Scheduler" to call the Console App every 5 minutes

KarmaEDV
- 1,631
- 16
- 27
0
You can write a simple console application which get's started by the windows task scheduler every 5 minutes. This would be the simplest and most stable way.

BendEg
- 20,098
- 17
- 57
- 131