IT Community - Software Programming, Web Development and Technical Support

simple windows service to generate automatic mails

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 ...


Go Back   IT Community - Software Programming, Web Development and Technical Support > Software Development > C# Programming

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 07-16-2007, 12:04 AM
kingmaker kingmaker is offline
D-Web Genius
 
Join Date: Jun 2007
Posts: 882
kingmaker is on a distinguished road
Send a message via Yahoo to kingmaker
Default simple windows service to generate automatic mails

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.
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


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


All times are GMT -7. The time now is 04:23 PM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.

SEO by vBSEO 3.0.0