public IActionResult Create(Employee _empdata) { _employee.AddEmployeeData(_empdata); ViewBag.Message = "Your contact"; ViewBag.Message = "Your contact"; // Instantiation Message class var message = new MimeMessage(); //Sender message.From.Add(new MailboxAddress("GIC", "*****@*****.**")); //Reciever Address message.Date = DateTime.Now; message.To.Add(new MailboxAddress("JOB REGISTRATION", _empdata.Email)); message.Subject = " Registring Suceessful"; using (var client = new SmtpClient()) /*{ client.ServerCertificateValidationCallback =(s,)}*/ { client.Connect("smtp.gmail.com", 587, false); client.Authenticate("*****@*****.**", "reginald160"); client.Send(message); client.Disconnect(true); } return(View("Details", _empdata)); }