namespace AlertMail { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void timer1_Tick(object sender, EventArgs e) { MailMessage loginInfo = new MailMessage(); string em = "toAddress@gmail.com"; loginInfo.To.Add(em.ToString()); loginInfo.From = new MailAddress("fromAddress@gmail.com"); loginInfo.Subject = "Alert Information"; loginInfo.Body = "Hai"; loginInfo.IsBodyHtml = true; SmtpClient smtp = new SmtpClient(); smtp.Host = "smtp.gmail.com"; smtp.Port = 587; smtp.EnableSsl = true; smtp.Credentials = new System.Net.NetworkCredential("fromAddress@gmail.com", "Password"); smtp.Send(loginInfo); label6.Text = "Alert is send to your email..!!"; } } }
timer1
Tick()
timer1_Tick()
private void Form1_Load(object sender, EventArgs e) { timer1.Interval = 1000; // setting my value here timer1.Start(); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)