public ActionResult Detail(int id) { if (Session["Model"] == null) { return(RedirectToAction("Login", "Account")); } else { LoginViewModel model = (LoginViewModel)Session["Model"]; bool isSSL = true; using (var context = new ImapBase("imap.gmail.com", model.Email, model.Password, AuthMethods.Login, 993, isSSL)) { MailMessage msg = context.GetMessage(id.ToString()); Session["MSG"] = msg; return(View(msg)); } } }
public ActionResult Delete(messageinfoviewmodel param) { if (Session["Model"] == null) { return(RedirectToAction("Login", "Account")); } else { ViewBag.Message = "Forward"; LoginViewModel model = (LoginViewModel)Session["Model"]; bool isSSL = true; using (var context = new ImapBase("imap.gmail.com", model.Email, model.Password, AuthMethods.Login, 993, isSSL)) { var msg = context.GetMessage(param.uid.ToString()); context.DeleteMessage(msg); return(RedirectToAction("Index", "Home")); } } }
public ActionResult Forward(messageinfoviewmodel param) { if (Session["Model"] == null) { return(RedirectToAction("Login", "Account")); } else { ViewBag.Message = "Forward"; LoginViewModel model = (LoginViewModel)Session["Model"]; bool isSSL = true; using (var context = new ImapBase("imap.gmail.com", model.Email, model.Password, AuthMethods.Login, 993, isSSL)) { var msg = context.GetMessage(param.uid.ToString()); mailmessageviewmodel msgviewmodel = new mailmessageviewmodel(); msgviewmodel.Subject = "Re: " + msg.To.FirstOrDefault().ToString(); msgviewmodel.Body = msg.Body + ">>>Forward=================================================="; return(View(msgviewmodel)); } } }