protected void Btn_SendMail_Click(object sender, EventArgs e) { MailMessage mail = new MailMessage(); mail.To.Add(txtTo.Text); //mail.To.Add("Another Email ID where you wanna send same email"); mail.From = new MailAddress("abc@xxx.com"); mail.Subject = txtSubject.Text; mail.Body = txtBody.Text; mail.IsBodyHtml = true; SmtpClient smtp = new SmtpClient(); smtp.Host = "smtp.gmail.com"; //Or Your SMTP Server Address smtp.Credentials = new System.Net.NetworkCredential("abc@xxx.com", "abcd123"); smtp.EnableSsl = true; smtp.Send(mail); Label1.Text = "Sent Successfully..."; clear();
<html> <head> <title>Test </title> </head> <body> <table> <tr> <td> USERName: </td> <td>Password </td> </tr> </table> </body> </html>
A potentially dangerous Request.Form value was detected from the client (txtBody="<html> <head> <tit..."). Description: Request Validation has detected a potentially dangerous client input value, and processing of the request has been aborted. This value may indicate an attempt to compromise the security of your application, such as a cross-site scripting attack. You can disable request validation by setting validateRequest=false in the Page directive or in the configuration section. However, it is strongly recommended that your application explicitly check all inputs in this case. Exception Details: System.Web.HttpRequestValidationException: A potentially dangerous Request.Form value was detected from the client (txtBody="<html> <head> <tit...").
validateRequest="false"
<httpruntime requestvalidationmode="2.0" />
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)