This is a discussion on simple windows service to generate automatic mails within the C# Programming forums, part of the Software Development category; Can anybody explain about Simple windows service to generate automatic mails? Auto Mail Generation: hi, here is simple way to ...
| |||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
| |||
| Can anybody explain about Simple windows service to generate automatic mails? Auto Mail Generation: hi, here is simple way to create a windows service for generating automatic mails, i have created this application for generating mail to intimate the customer that your subscription is coming to end, first i populated this logic in ordinary aspx page, 1. fetched all user records from the DB, 2. Created logic to find whether the user subscription is expired or not 3. If it expired mail is sent to him, 4. If we implement this logic in windows service it will check for the interval what we gave so to avoid repetition sending mail, I kept on status field in DB and updated it and thus I avoided mail repetition, After that I had created one windows service and created on .cs file and implement this login in that. open the service :service.designer.cs In InitializeComponent(), we need to intials evenlog,service name, and timer private System.Timers.Timer timer1; private System.Diagnostics.EventLog eventLog1; { this.eventLog1 = new System.Diagnostics.EventLog(); this.timer1 = new System.Timers.Timer(); this.eventLog1.Log = "AutoMailGenerationLog"; this.eventLog1.Source = "AutoMailGenerationSource"; timer1.Interval = 60000; timer1.Enabled = true; timer1.Elapsed += new ElapsedEventHandler(OnTimer); } In service page we need to create onstart, OnStop,OnPause,OnContinue, In OnTimer event we need to call the function (logic) we created, and send eventlog object to that logic, There we can log the information in log file using (eventLogobject.WriteEntry("Started") ![]() After that build the service and then create on setup and deployment project and set the above service in primary output and build the setup the we will get the .exe file for our setup Last edited by kingmaker : 07-16-2007 at 12:07 AM. |
| Sponsored Links |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Windows Service error | oxygen | C# Programming | 1 | 02-27-2008 09:48 PM |
| Windows Service | Balasubramanian.S | C# Programming | 1 | 02-27-2008 09:47 PM |
| How to Develop an Simple Message Service Component(SMS) of my own? | Mramesh | C# Programming | 0 | 12-26-2007 03:55 AM |
| How to create a windows service program? | Mramesh | C# Programming | 12 | 09-05-2007 08:11 AM |
| How to create a simple dll using VC++ and how to register it windows XP? | oxygen | C and C++ Programming | 1 | 07-24-2007 05:25 AM |