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

How can i do an sleep in while(true)

$
0
0
            while (true)            {                System.Threading.Thread.Sleep(1);                ReadInput();                Application.DoEvents();                MailMessage mail = new MailMessage();                SmtpClient SmtpServer = new SmtpClient("smtp.gmail.com");                System.Threading.Thread.Sleep(2000);                mail.From = new MailAddress("");                mail.To.Add("");                mail.Subject = "Test Mail";                mail.Attachments.Add(new System.Net.Mail.Attachment("C://Users//matte//test.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);                System.Threading.Thread.Sleep(10000);            }

I tried an cooldown but the email is keeping sending without sleep how can i do that that every 30 minutes the email get sendet??


Viewing all articles
Browse latest Browse all 29769

Trending Articles



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