How To Send Daily/Schedule Mails Using Windows Service

Attached code send the schedule mail. How can you proceed with it, see steps below :

  • Extract & use VS 2010 to edit mail body, subject & time period.
  • After extract open it using VS2010.
  • Open LM.cs.
  • Go to Line No 25 and update the period as required. i.e dtMail = new Timer(tcb, null, 60000, 60000); dtMail = new Timer(tcb, null, 60000, 60000*60*24);
  • Now go to SendMail Method and update parameters. From, To, Sub Body, SMTP Parameters.
  • After completing above steps you to build it.
  • After build it you will get debug folder.
  • Copy the Debug folder to another location.
  • Now open Command prompt and switch to this location.
  • Now you have to install it using command C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\InstallUtil.exe LmService.exe
  • After successful run this command you can see the Service in AdminstrativeTools\Services Name “LM”.
  • Select & update this properties to Automatic & Run it.
  • Now you can get mail.

Download Source


Posted

in

by

Tags: