public ActionResult Index(FormCollection values, Models.ContactForm cf) { ViewBag.Active = "about"; try { var message = new MailMessage("*****@*****.**", "*****@*****.**"); var sb = new StringBuilder(); sb.AppendLine("Whoa, Jeff! Someone wants to chat!"); sb.AppendLine(); for (int i = 0; i < values.Count; i++) { sb.AppendLine(values.Keys[i] + " : " + values[i]); } sb.AppendLine(); sb.AppendLine("I love you"); sb.AppendLine("Signed,"); sb.AppendLine("The Robots"); //set the body of the email to the string message.Body = sb.ToString(); //set a subject message.Subject = "New SeedPaths Contact Request"; var client = new SmtpClient("mail.dustinkraft.com", 587) { Credentials = new System.Net.NetworkCredential("*****@*****.**", "techIsFun1") }; //relay-hosting.secureserver.net //jeff.macco. client.Send(message); } catch (Exception) { } var db = new Models.seedpathsEntities(); cf.DateCreated = DateTime.Now; db.ContactForms.Add(cf); db.SaveChanges(); ViewBag.Name = cf.Name; return View("ThankYou"); }
public ActionResult Index(FormCollection values, Models.Application app) { try { var message = new MailMessage("*****@*****.**", "*****@*****.**"); var sb = new StringBuilder(); sb.AppendLine("Hey Pat! How's it going? Got a new app for ya."); sb.AppendLine(); for (int i = 0; i < values.Count; i++) { sb.AppendLine(values.Keys[i] + " : " + values[i]); } sb.AppendLine(); sb.AppendLine("I love you"); sb.AppendLine("Signed,"); sb.AppendLine("The Robots"); //set the body of the email to the string message.Body = sb.ToString(); //set a subject message.Subject = "New SeedPaths Application"; var client = new SmtpClient("mail.dustinkraft.com", 587) { Credentials = new System.Net.NetworkCredential("*****@*****.**", "techIsFun1") }; client.Send(message); } catch (Exception) { } var db = new Models.seedpathsEntities(); app.dtCreated = DateTime.Now; db.Applications.Add(app); db.SaveChanges(); //add the name to the ViewBag ViewBag.Name = app.FirstName; return View("ThankYou"); }
public ActionResult Newsletter(FormCollection values) { try { var message = new MailMessage("*****@*****.**", "*****@*****.**"); var sb = new StringBuilder(); sb.AppendLine("Whoa! Someone wants to be in the know!"); sb.AppendLine(); for (int i = 0; i < values.Count; i++) { sb.AppendLine(values.Keys[i] + " : " + values[i]); } sb.AppendLine(); sb.AppendLine("I love you"); sb.AppendLine("Signed,"); sb.AppendLine("The Robots"); //set the body of the email to the string message.Body = sb.ToString(); //set a subject message.Subject = "New SeedPaths Newsletter Request"; var client = new SmtpClient("mail.dustinkraft.com", 587) { Credentials = new System.Net.NetworkCredential("*****@*****.**", "techIsFun1") }; client.Send(message); } catch (Exception ex) { } ViewBag.Name = values["email"]; var db = new Models.seedpathsEntities(); var n = new Models.Newsletter() { Email = values["email"], DateCreated=DateTime.Now }; db.Newsletters.Add(n); db.SaveChanges(); return View("ThankYou"); }