try { MailMessage Msg = new MailMessage(); // Sender e-mail address. Msg.From = new MailAddress(txtUsername.Text); // Recipient e-mail address. Msg.To.Add(txtTo.Text); Msg.Subject = txtSubject.Text; Msg.Body = txtBody.Text; // your remote SMTP server IP. SmtpClient smtp = new SmtpClient(); smtp.Host = "smtp.gmail.com"; smtp.Port = 587; smtp.Credentials=new System.Net.NetworkCredential(txtUsername.Text,txtpwd.Text); smtp.EnableSsl = true; smtp.Send(Msg); Msg = null; <pre lang="xml">Page.RegisterStartupScript("UserMsg", "<script>alert('Mail sent thank you...');if(alert){ window.location='default.aspx';}</script>"); } 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)