try { var fromAddress = "contactus@investemu.com"; var toAddress = txtfrmmailid.Text.ToString(); string fromPassword ="mypassword"; string subject = txtsubject.Text.ToString(); string body = "From: Carshop\n"; body += "Email: contactus@investemu.com\n"; body += "Subject: " + txtsubject.Text + "\n"; body += "Message: \n" + txtcomments.Text + "\n"; // smtp settings var smtp = new System.Net.Mail.SmtpClient(); { smtp.Host = "smtp.investemu.com"; smtp.Port = 25; smtp.EnableSsl = true; smtp.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network; smtp.Credentials = new NetworkCredential(fromAddress, fromPassword); smtp.Timeout = 20000; } // Passing values to smtp object smtp.Send(fromAddress, toAddress, subject, body); } catch (Exception err) { errormessage(err.Message); }
private void errormessage(string msg) { Response.Write("<script type=Text/Javascript> alert('" + msg + "'); </script>"); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)