Here is the code in C#
Convert it by youself. Also an adivce. Try and google your query first.
using System.Net.Mail;
using System.Net;
public partial class Default2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btnSubmitt_Click(object sender, EventArgs e)
{
MailMessage mail = new MailMessage();
mail.Subject = "Enquiry";
mail.Body = "<b>Name :</b>" + txtName.Text + "<br/> +<b>Address:</b>" + txtAddress.Text + "<br/><b>Email-Id :</b>" + txtEmailId.Text + "<br/><b>city :</b>" + txtCity.Text + "<br/><b>Phone :</b>" + txtPhoneNo.Text + "<br/><b>Organisation:</b>" + txtOrganisation.Text + "<br/><b>Comment:</b>" + txtComment.Text;
mail.From = new System.Net.Mail.MailAddress("abc@gmail.com", "Enquiry From Website");
mail.IsBodyHtml = true;
mail.To.Add("info@gmail.com");
NetworkCredential cred = new NetworkCredential("abc@gmail.com", "xyz[what ever the password is]");
SmtpClient smtp = new SmtpClient("smtp.gmail.com");
smtp.UseDefaultCredentials = false;
smtp.EnableSsl = true;
smtp.Credentials = cred;
smtp.Port = 587;
smtp.Send(mail);
clear();
}
private void clear()
{
txtComment.Text = "";
txtEmailId.Text = "";
txtName.Text = "";
txtOrganisation.Text = "";
txtPhoneNo.Text = "";
txtCity.Text = "";
txtAddress.Text = "";
}
protected void btnReset_Click(object sender, EventArgs e)
{
clear();
}
}