public ActionResult ProposalReport() { MailModel m = new MailModel(); m.ProposalList = m.Proposals(); m.IdList = m.IDS(); return(View("ProposalReport", m)); }
public async Task <ActionResult> SendMail(MailModel mail) { mail.ProposalList = mail.Proposals(); mail.IdList = mail.IDS(); string body = "<div style='font-family:Calibri;font-size: 10pt;'><p>Dear Project Investigator, </p><br/>" + "<p>Sub: In respect of Project Proposal Title: " + mail.ProposalTitle + "</p><br/>" + "<p> As per our IC & SR record, you have undertaken following agreements as witness/confirming party, which are still effective.</p><p> This is to request you to check that your new project proposal is not conflicting with the existing Agreement(s).</p>"; body += "<table style='font-family:Calibri;font-size: 10pt;' border='1' style='border: 1px solid lightgrey;border-collapse: collapse; border-spacing: 0;' class='table table-striped table-bordered'><tr><th>SI.No</th><th>Industry Partner</th><th>Kind of Agreement</th><th>Effective Date</th><th>End Date</th><th>Remarks</th></tr>"; foreach (var m in mail.Dean_trxList) { body += "<tr><td>" + m.Sno + "</td>" + "<td>" + m.Partner + "</td>" + "<td>" + m.Agreement_type + "</td>" + "<td>" + m.Signed_date + "</td>" + "<td>" + m.Expiry_date + "</td>" + "<td>" + m.Title + "</td>" + "</tr>"; } body += "</table>"; body += "<p>Best Regards</p>"; body += "<p>Dean IC&SR</p>" + "<p>NOTE: This is a System generated mail, for any queries Contact Project Office IC&SR.</p></div>"; var message = new MailMessage(); message.To.Add(new MailAddress("*****@*****.**")); message.CC.Add(new MailAddress("*****@*****.**")); message.From = new MailAddress("*****@*****.**"); message.Subject = "In respect of Project Proposal" + mail.ProposalNo + " Title: " + mail.ProposalTitle; message.Body = string.Format(body); message.IsBodyHtml = true; using (var smtp = new SmtpClient()) { //var credential = new NetworkCredential //{ // UserName = "******", // Password = "******" //}; //smtp.Credentials = credential; //smtp.Host = "smtp.gmail.com"; //smtp.Port = 587; //smtp.EnableSsl = true; await smtp.SendMailAsync(message); TempData["message"] = "Sent"; return(View("ProposalReport", mail)); //return Json(new { success = true, title = "Mail Sent", message = "Mail sent to : " + message.To, JsonRequestBehavior.AllowGet }); } }
public ActionResult ProposalReport(MailModel m) { if (m.ProposalNo != null) { m.ProposalTitle = dMS_BusinessLayer.GetProposalTitle(m.ProposalNo); } else if (m.ProjectNo != null) { m.ProposalTitle = dMS_BusinessLayer.GetProjectTitle(m.ProjectNo); } m.FMail = dMS_BusinessLayer.FacDetails(m.InstiId); m.Dean_trxList = dMS_BusinessLayer.MapAgreementToCoor(m.InstiId); m.ProposalList = m.Proposals(); m.IdList = m.IDS(); return(View(m)); }