protected void btnSubmit_Click(object sender, EventArgs e) { try { MailMessage Msg = new MailMessage(); // Sender e-mail address. Msg.From = new MailAddress(txtEmail.Text); // Recipient e-mail address. Msg.To.Add("info@dhuvara.com"); Msg.Subject = txtEmail.Text; Msg.Body = "NAME : " + txtName.Text + "EMAIL : " + txtEmail.Text + " SUBJECT : " + txtSubject.Text + "MESSAGE: " + txtMessage.Text; Msg.IsBodyHtml = true; // your remote SMTP server IP. SmtpClient smtp = new SmtpClient(); smtp.Host = "smtp.live.com"; smtp.Port = 587; Msg.Priority = MailPriority.Normal; smtp.UseDefaultCredentials = false; smtp.Credentials = new System.Net.NetworkCredential("info@dhuvara.com", "SolaiMail"); smtp.EnableSsl = true; smtp.Send(Msg); //Msg = null; lbltxt.Text = "Thanks for Contact us"; // Clear the textbox valuess txtName.Text = ""; txtSubject.Text = ""; txtMessage.Text = ""; txtEmail.Text = ""; } catch (Exception ex) { Console.WriteLine("{0} Exception caught.", ex.ToString()); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)