private void SendNotificationEmail(NotificationSignup signup) { var fromAddress = new MailAddress("*****@*****.**", "Hockey App"); var toAddress = new MailAddress(signup.Email, $"{signup.FirstName} {signup.LastName}"); string fromPassword = "******"; string subject = "New Game Posted!"; string body = $"Hey {signup.FirstName}, The admin has posted a new game, sign up now to secure a spot!"; var smtp = new SmtpClient { Host = "smtp.gmail.com", Port = 587, EnableSsl = true, DeliveryMethod = SmtpDeliveryMethod.Network, UseDefaultCredentials = false, Credentials = new NetworkCredential(fromAddress.Address, fromPassword) }; using (var message = new MailMessage(fromAddress, toAddress) { Subject = subject, Body = body }) { smtp.Send(message); } }
public ActionResult NotificationSignup(string firstName, string lastName, string email) { var db = new HockeySignupsDb(_connectionString); var ns = new NotificationSignup { Email = email, FirstName = firstName, LastName = lastName }; db.AddNotificationSignup(ns); return(View("NotificationSignupConfirmation")); }
public ActionResult NotificationSignup(string firstName, string lastName, string email) { var db = new HockeySignupsDb(Properties.Settings.Default.ConStr); var ns = new NotificationSignup { Email = email, FirstName = firstName, LastName = lastName }; db.AddNotificationSignup(ns); return(View("NotificationSignupConfirmation")); }