public ActionResult Index()
 {
     ProjectSubmission project = new ProjectSubmission();
     project.Deadline = DateTime.Now;
     project.FirstProofDate = DateTime.Now;
     return View(project);
 }
 private void SetMessageBody(ProjectSubmission project, ISendGrid email)
 {
     email.Html = @"<html>
     <body>
     <h1>A new project was submitted! Yay!</h1>
     <table style='border-collapse: collapse;'>
     <tr>
     <td style='border: 1px solid #CCC; padding: 5px;'><b>Project name:</b></td>
     <td style='border: 1px solid #CCC; padding: 5px;'>" + project.ProjectName + @"</td>
     </tr>
     <tr>
     <td style='border: 1px solid #CCC; padding: 5px;'><b>Requested by:</b></td>
     <td style='border: 1px solid #CCC; padding: 5px;'>" + project.RequestedBy + @"</td>
     </tr>
     <tr>
     <td style='border: 1px solid #CCC; padding: 5px;'><b>Details and dimensions:</b></td>
     <td style='border: 1px solid #CCC; padding: 5px;'>" + project.DetailsAndDimensions + @"</td>
     </tr>
     <tr>
     <td style='border: 1px solid #CCC; padding: 5px;'><b>Deadline:</b></td>
     <td style='border: 1px solid #CCC; padding: 5px;'>" + project.Deadline.ToShortDateString() + @"</td>
     </tr>
     <tr>
     <td style='border: 1px solid #CCC; padding: 5px;'><b>First proof due:</b></td>
     <td style='border: 1px solid #CCC; padding: 5px;'>" + project.FirstProofDate.ToShortDateString() + @"</td>
     </tr>
     <tr>
     <td style='border: 1px solid #CCC; padding: 5px;'><b>Key objective/Call to action:</b></td>
     <td style='border: 1px solid #CCC; padding: 5px;'>" + project.KeyObjective + @"</td>
     </tr>
     <tr>
     <td style='border: 1px solid #CCC; padding: 5px;'><b>Key graphics needed:</b></td>
     <td style='border: 1px solid #CCC; padding: 5px;'>" + project.KeyGraphicsNeeded + @"</td>
     </tr>
     <tr>
     <td style='border: 1px solid #CCC; padding: 5px;'><b>Target audience:</b></td>
     <td style='border: 1px solid #CCC; padding: 5px;'>" + project.TargetAudience + @"</td>
     </tr>
     <tr>
     <td style='border: 1px solid #CCC; padding: 5px;'><b>Additional comments:</b></td>
     <td style='border: 1px solid #CCC; padding: 5px;'>" + project.AdditionalComments + @"</td>
     </tr>
     </table>
     </body>
     </html>";
 }
        public ActionResult Index(ProjectSubmission project)
        {
            if (project.IsValid()) {
                ISendGrid email = SendGrid.GenerateInstance();
                email.AddTo("*****@*****.**");
                email.From = new MailAddress("*****@*****.**");
                email.Subject = "New project submitted: " + project.ProjectName;
                SetMessageBody(project, email);

                SMTP server = SMTP.GenerateInstance(new NetworkCredential("*****@*****.**", "7tydml1z"));
                server.Deliver(email);

                return View("EmailResult");
            } else {
                return View();
            }
        }