protected void Button1_Click(object sender, EventArgs e) { MailMessage mm = new MailMessage(); try { mm.From = "gopiyadavalli@yahoo.com"; // this is ur mail ID mm.To =txtto .Text.ToString(); mm.Body = txtmsgbody.Text.ToString(); mm.Subject = txtsub.Text.ToString(); System.Web.Mail.SmtpMail.Send(mm); lblmsg.Text = "Email successfully sent."; } catch (Exception ex) { lblmsg.Text = "Send Email Failed." + ex.Message; } }