public static void BuildRegistrationEmailTemlplate(string userEmail) { using (DiplomaDBContext db = new DiplomaDBContext()) { string body = System.IO.File.ReadAllText(HostingEnvironment.MapPath("~/EmailTemplates/") + "Text" + ".cshtml"); var user = db.ListOfUsers.Where(x => x.Email == userEmail).FirstOrDefault(); if (user != null) { var url = "http://*****:*****@ViewBag.ConfirmationLink", url); body = body.ToString(); BuildEmailTemlplate("Twoje konto zostało utworzone", body, user.Email); } } }