The better solution is to change your application to be a console
application and invoke it using the Windows Scheduled Tasks.  This way you
can utilize the scheduling mechanism that is already in place, or you can
pick your own without having to modify your code.

Search the archives of this group for this task and you will find that it
has been discussed in great detail here in the past.

...Glenn

On Tue, Oct 7, 2008 at 8:21 AM, [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.
>
>

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