Try this..:)
.aspx page...:)
<div>
<table>
<tr>
<td>
Your name:
</td>
<td>
<asp:TextBox ID="YourName" runat="server" Width="250px" />
</td>
</tr>
<tr>
<td>
Your age:
</td>
<td>
<asp:TextBox ID="YourAge" runat="server" Width="250px" />
</td>
</tr>
<tr>
<td>
Gender:
</td>
<td>
<asp:TextBox ID="txtGender" runat="server" Width="250px" />
</td>
</tr>
<tr>
<td>
Mobile:
</td>
<td>
<asp:TextBox ID="txtMobile" runat="server" />
</td>
</tr>
<tr>
<td>
EmailID
</td>
<td>
<asp:TextBox ID="txtEmailID" runat="server" />
</td>
</tr>
<tr>
<td>
Description:
</td>
<td>
<asp:TextBox ID="txtdescrition" runat="server" />
</td>
</tr>
<tr>
<td colspan="2">
<asp:Button ID="Button1" runat="server" Text="Send"
OnClick="Button1_Click" ValidationGroup="save" />
</td>
</tr>
<tr>
<td colspan="2"><asp:label id="DisplayMessage" runat="server" visible="false" xmlns:asp="#unknown" /></td>
</tr>
</table>
</div>
.aspx.cs page...:)
protected void SendMail()
{
var fromAddress = "Your email address";
var toAddress = txtEmailID.Text.ToString();
const string fromPassword = "Password";
string subject = txtdescrition.Text.ToString();
string body = "From: " + YourName.Text + "\n";
body += "Email: " + txtEmailID.Text + "\n";
body += "Subject: " + txtdescrition.Text + "\n";
body += "Mobile: \n" + txtMobile.Text + "\n";
var smtp = new System.Net.Mail.SmtpClient();
{
smtp.Host = "smtp.gmail.com";
smtp.Port = 587;
smtp.EnableSsl = true;
smtp.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network;
smtp.Credentials = new NetworkCredential(fromAddress, fromPassword);
smtp.Timeout = 20000;
}
smtp.Send(fromAddress, toAddress, subject, body);
}
protected void Button1_Click(object sender, EventArgs e)
{
SendMail();
try
{
SendMail();
DisplayMessage.Text = "Your Comments after sending the mail";
DisplayMessage.Visible = true;
YourSubject.Text = "";
txtEmail.Text = "";
YourName.Text = "";
Comments.Text = "";
}
catch (Exception) { }
}