<input type="text" name="contactFormName" id="name" onfocus="clearInput(this,'focus','Enter your name')" önblur="clearInput(this,'blur','Enter your name')" runat="server" />
<input type="text" name="contactFormEmail" id="mail" onfocus="clearInput(this,'focus','Enter your e-mail')" önblur="clearInput(this,'blur','Enter your e-mail')" runat="server" />
<textarea name="contactFormMessage" id="msg" rows="0" cols="0" onfocus="clearInput(this,'focus','Enter your message')" runat="server" önblur="clearInput(this,'blur','Enter your message')"></textarea>
<input id="but" runat="server" name="contactFormSend" onblur="clearInput(this,'blur','Send')"
onfocus="clearInput(this,'focus','Send')" type="button" value="Send" style="width: 100px" önserverclick="but_ServerClick">
protected void but_ServerClick(object sender, EventArgs e)
{
try {
string to = "sample@gmail.com";
MailMessage email = new MailMessage();
email.To.Add(to);
MailAddress maFrom = new MailAddress("sample@gmail.com");
email.From = maFrom;
email.Subject = "Contact Detail";
email.IsBodyHtml = true;
email.Body = "<html><body> <font face="\"Cambria\"" size="\"3\""><center><h3>Registration</h3></center><br />Name :" + name.Value + "<br /><br /> Email ID :" + mail.Value + "<br /><br /> Message : " +msg.Value+ "<br /><br /></font></body></html>";
SmtpClient smtp = new SmtpClient("smtp.gmail.com", 25);
smtp.EnableSsl = true;
smtp.Credentials = new System.Net.NetworkCredential("sample@gmail.com", "sample");
smtp.Send(email);
}
catch (Exception ex)
{
Exception E = ex;
}
}
Here my button click not captured my input text.. It sends mail as Name: Enter your Name.
Mail as Enter your mail
Can anyone help me?