RUrinnyroplon
New Member
Here I am currently having some date vales in my SQL Server 2008 DB. And I want to send e-mail alerts to a particular mail address when that date value equals to current date. Just imagine an automated b'day wishing software.Here is the code i'm using for e-mail functionality.It is working without any issue. \[code\]private void sendMailMessage() { try { MailMessage myMessage = new MailMessage(); myMessage.From = new MailAddress("[email protected]", "Online Alert System"); myMessage.To.Add(new MailAddress("[email protected]")); myMessage.Subject = "Test Mail"; myMessage.Body = "This is test mail from OAS."; myMessage.IsBodyHtml = true; SmtpClient mySmtpClient = new SmtpClient(); mySmtpClient.Host="smtp.gmail.com"; mySmtpClient.Port= 587; mySmtpClient.Credentials = new NetworkCredential("[email protected]", "password"); mySmtpClient.EnableSsl = true; mySmtpClient.Send(myMessage); } catch (Exception ex) { throw new Exception(ex.Message); } }\[/code\]But I want to do this using widows service. Please explain me how can I do this. In this case I have only little knowledge about windows services.Thanks in advance..!