using System.Net; using System.Net.Mail; private void button1_Click(object sender, EventArgs e) { try { string idfrom = textBox1.Text; String password = textBox2.Text; String idto = textBox3.Text; string msg = richTextBox1 .Text ; string sub = textBox4.Text; var smtp = new SmtpClient(); { smtp.Host = "smtp.gmail.com"; smtp.Port = 587; smtp.EnableSsl = true; smtp.DeliveryMethod = SmtpDeliveryMethod.Network; smtp.Credentials = new NetworkCredential(idfrom,password); smtp.Timeout = 20000; } smtp.Send(idfrom, idto, sub , msg); MessageBox.Show("Message has been sent"); } catch(Exception ex) { MessageBox.Show(ex.Message ); } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)