You need to devide your application in two parts.
You can write Windows Service which will always running on your machine which will send mails.
And from your VB.net code you can start that service.
So you need to write following steps;
Step1: Write one windows service which will send mail automatically every day on timer.
Just go thr these links which will tell you how to create windows service;
http://www.developer.com/article.php/2173801
http://www.codeproject.com/KB/dotnet/simplewindowsservice.aspx
Step2: You need to write code for sending mail in that windows service. Check out this simple code for sending mails;
Dim mailmsg As New System.Net.Mail.MailMessage()
mailmsg.From = New MailAddress("fromMaiId@gmail.com")
mailmsg.To.Add("toMaiId @gmail.com")
mailmsg.Subject = "Mail From .Net Application"
mailmsg.IsBodyHtml = True
mailmsg.Body = "Hi this is a mail from .net appl i have used same code......"
mailmsg.Priority = MailPriority.Normal
Dim client As New System.Net.Mail.SmtpClient()
client.UseDefaultCredentials = False
client.Credentials = New System.Net.NetworkCredential("fromMaiId @gmail.com", "mypassword")
client.Port = "587"
client.Host = "smtp.gmail.com"
client.EnableSsl = True
Dim userstate As Object = mailmsg
client.Send(mailmsg)
Step3: You need to start this service from your application on button click. Check this code for that;
Imports System.ServiceProcess
dim controller
as new ServiceController
controller.MachineName = "."
controller.ServiceName = "IISADMIN"
dim status as string = controller.Status.ToString
'Start the service
controller.Start()
Try these steps.