Fill the information and click on 'Generate Id' ..The otp will get sent to you in your mail. Generate_id Link button code- protected void LinkButton1_Click(object sender, EventArgs e) { string s = ConfigurationManager.AppSettings["db"]; cn = new SqlConnection(s); cn.Open(); string q = "select max(roll)+1 from gen_id "; cm = new SqlCommand(q, cn); SmtpClient sm = new SmtpClient("student-cell.com", 25); sm.Credentials = new System.Net.NetworkCredential("contact@student-cell.com", "Fg8@or61"); sm.DeliveryMethod = SmtpDeliveryMethod.Network; MailMessage mm = new MailMessage("contact@student-cell.com", TextBox3.Text); if(TextBox3.Text == "" ) { ...