try { System.Net.Mail.MailMessage Msg = new System.Net.Mail.MailMessage(); // Sender e-mail address. Msg.From = new MailAddress(txtEmail.Text); // Recipient e-mail address. Msg.To.Add("administrator@aspdotnet-suresh.com"); Msg.Subject = txtSubject.Text; Msg.Body = txtmsg.Text; // your remote SMTP server IP. SmtpClient smtp = new SmtpClient(); smtp.Host = "smtp.gmail.com"; smtp.Port = 587; //smtp.Credentials = new System.Net.NetworkCredential("yourgmailemail@gmail.com", "yourpassword"); smtp.EnableSsl = true; smtp.Send(Msg); //Msg = null; success.Text = "Thanks for Contact us"; // Clear the textbox valuess txtname.Text = ""; txtSubject.Text = ""; txtmsg.Text = ""; txtEmail.Text = ""; } catch (Exception ex) { // Console.WriteLine("{0} Exception caught.", ex); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)