you can add a timer to the service and set your event on the tick
event of the timer.  you can then set the interval to be whatever you
need, however if the service stops and doesn't restart, you won't get
anything.

On 7 Oct, 13:21, "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> wrote:
> Hi,
>
> I want to genenerate email automatically oon evry thursday. I found
> that using windows service solution will be the simple.
>
> I had written the following code in widows service.
>
> protected override void OnStart(string[] args)
>         {
>   if(DateTime.Now.DayOfWeek == DayOfWeek.Thursday)
>    {
>    MailMessage ms = new MailMessage(From,To,"Hi","message body");
>    SmtpClient snd = new SmtpClient("---"); //Exchange server name
>                 snd.Send(ms);
>    }
>
> }
>
> Problem is that it is generating mail only once when the service
> starts. But, I want to  generate mail automatically evry
> weekend.......Or evry day.....or evry Hour.
>
> Please let me know How Can I generate mail automatically based on
> criteria.
>
> Thanks in advance.
>
> waiting for reply.
>
> Thanks and Regards,
> Pradeep
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web 
Services,.NET Remoting" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/DotNetDevelopment

You may subscribe to group Feeds using a RSS Feed Reader to stay upto date 
using following url  

<a href="http://feeds.feedburner.com/DotNetDevelopment";> 
http://feeds.feedburner.com/DotNetDevelopment</a>
-~----------~----~----~----~------~----~------~--~---

Reply via email to