public static void SendCustomEmail(EmailViewModel email)
        {
            string to = email.Email;
            string from = ConfigurationManager.AppSettings["MvcConfirmationEmailFromAccount"];

            var message = new MailMessage(from, to)
            {
                Subject = email.Subject,
                Body = email.Body
            };

            var client = new SmtpClient();
            client.EnableSsl = true;
            client.Send(message);
        }
 public ActionResult SendStudentAnEmail(EmailViewModel model)
 {
     if (ModelState.IsValid)
     {
         AccountMembershipService.SendCustomEmail(model);
         return RedirectToAction("Message", "Course", new {message = "Your email has been sent."});
     }
     return View("Error");
 }
 public ActionResult SendStudentAnEmail(string emailAddress)
 {
     var emailViewModel = new EmailViewModel
                              {
                                  Email = emailAddress,
                                  Subject = "Put Subject Here",
                                  Body = "Put Body Here"
                              };
     return View(emailViewModel);
 }