public void SendEmail(PointSumaryModel model, string gift) { bool sendSuccess = false; //ViewBag.qqq = EmailManager.BuildPartnerInfoHtmlBody(model); EmailManager em = new EmailManager(); EmailContents ec = new EmailContents(model.Name, Globals.Settings.ContactForm.MailTo, model.Email, "Send a reward gift", EmailManager.BuildSendGiftBody(model, gift)); em.Send(ec); // send to foodready.net if (em.IsSent == false) { sendSuccess = false; } else { sendSuccess = true; } ec = new EmailContents("Foodready.net", model.Email, Globals.Settings.ContactForm.MailTo, "You get a gift!", EmailManager.BuildGiftToCustomerBody(model, gift)); em.Send(ec); // send to Customer if (em.IsSent == false) { sendSuccess = false; } else { sendSuccess = true; } ViewBag.SendingSuccess = sendSuccess; }
public ActionResult EmailOrder(int id, int orderid) // id=DriverId { ViewBag.msg = ""; OrderDriversModel odm = new OrderDriversModel(); odm.Order = OrderRepository.GetOrderById(orderid); odm.Driver = DriverRepository.GetDriverById(id); EmailManager em = new EmailManager(); EmailContents ec = new EmailContents(); ec.FromEmailAddress = Globals.Settings.ContactForm.MailFrom; ec.FromName = "foodready.net"; ec.Subject = "Delivery order"; ec.To = odm.Driver.Email; ec.Body = EmailManager.BuildEmailToDriverHtmlBody(odm.Order, odm.Driver.FirstName + " " + odm.Driver.LastName); em.Send(ec); if (em.IsSent == false) { ViewBag.msg = "email failed!"; } else { OrderRepository.UpdateOrderByEmail(orderid, odm.Driver.FirstName + " " + odm.Driver.LastName, DateTime.Now, UserName); } return(PartialView(odm)); }
public async Task <ActionResult> Register(string returnUrl, RegisterViewModel model, bool captchaValid, string mobile, string captchaErrorMessage, ShoppingCart cart) { ViewBag.bagitems = GetCartItems(cart); if (ModelState.IsValid) { if (!captchaValid) { ModelState.AddModelError("recaptcha", captchaErrorMessage); ViewBag.ReturnUrl = returnUrl; return(View(model)); } var user = new ApplicationUser { UserName = model.Email, Email = model.Email, AddedDate = DateTime.Now, UpdatedDate = DateTime.Now, Active = true }; var result = await UserManager.CreateAsync(user, model.Password); if (result.Succeeded) { // await SignInManager.SignInAsync(user, isPersistent: false, rememberBrowser: false); var code = await UserManager.GenerateEmailConfirmationTokenAsync(user.Id); var callbackUrl = Url.Action("ConfirmEmail", "Account", new { userId = user.Id, code = code }, protocol: Request.Url.Scheme); try { Address ar = AddressRepository.AddAddress(0, model.AddressLine, "", model.City, model.State, model.ZipCode, "", DateTime.Now, model.Email, DateTime.Now, model.Email, true); ContactInfo ci = ContactInfoRepository.AddContactInfo(0, model.Phone, "", model.Email, DateTime.Now, model.Email, DateTime.Now, model.Email, true); UserDetail ud = UserDetailRepository.InsertUserDetail(0, user.Id, model.FirstName, model.LastName, ar.AddressId, ci.ContactInfoId, DateTime.Now, model.Email, DateTime.Now, model.Email, true, CryptionClass.Encrypt(model.Password)); EmailManager em = new EmailManager(); EmailContents ec = new EmailContents(); ec.FromEmailAddress = Globals.Settings.ContactForm.MailFrom; ec.FromName = "FoodReady.Net"; ec.Subject = "confirm your email address for your foodready.net account"; ec.To = model.Email; ec.Body = "Please confirm your account by clicking this link: <a href=\"" + callbackUrl + "\">link</a>"; em.Send(ec); } catch (Exception e) { ModelState.AddModelError("", "Something failed: " + e.Message); return(View(model)); } //await UserManager.SendEmailAsync(user.Id, "Confirm your account", "Please confirm your account by clicking this link: <a href=\"" + callbackUrl + "\">link</a>"); ViewBag.Link = callbackUrl; return(View("DisplayEmail")); } AddErrors(result); } // If we got this far, something failed, redisplay form return(View(model)); }
public void SendGroupEmail(ShoppingCart cart, string paypalTotal) { EmailManager em = new EmailManager(); EmailContents ec = new EmailContents(); BizInfo bi = BizInfoRepository.GetBizInfoById(cart.BizId); em.EMBizInfo = bi; em.EMShoppingCart = cart; em.OrderTime = DateTime.Now.ToShortTimeString() + " " + DateTime.Now.ToShortDateString(); TempData["DeliveryAddress"] = ""; em.OrderType = cart.IsDelivery ? "Delivery" : "Pickup"; em.PaymentType = "Credit Card"; em.ScheduleDateTime = base.CurrentOrder.ScheduleTime + ", " + base.CurrentOrder.ScheduleDate; em.OrderNumber = (800000000 + base.CurrentOrder.OrderId).ToString(); em.Name = base.CurrentOrder.FirstName + " " + base.CurrentOrder.LastName; em.Address = base.CurrentOrder.Street; em.City = base.CurrentOrder.City; em.State = base.CurrentOrder.State; em.Zip = base.CurrentOrder.ZipCode; em.Phone = base.CurrentCreditCard.Phone; em.IpAddress = base.CurrentUserIP; em.CreditCardType = CreditCardTypeRepository.GetCreditCardTypeById(base.CurrentCreditCard.CreditCardTypeId).Title; em.CreditCardNumber = "xxxx-xxxx-xxxx-" + base.CurrentCreditCard.CreditCardNumber.Substring(base.CurrentCreditCard.CreditCardNumber.Length - 4); em.ExpirationDate = base.CurrentCreditCard.ExpirationMonth.ToString() + "/" + base.CurrentCreditCard.ExpirationYear.ToString(); em.SecurityCode = "xx" + base.CurrentCreditCard.SecurityCode.ToString().Substring(base.CurrentCreditCard.SecurityCode.ToString().Length - 1);; em.Subtotal = Helper.FormatPriceWithDollar(cart.SubTotal());; em.Tax = ToUSD(cart.Tax().ToString("N2")); em.CouponChoice = base.CurrentOrder.CouponChoice; em.ServiceCharge = ToUSD(cart.serviceCharge.ToString("N2")); em.DeliveryCharge = ToUSD(cart.DeliveryFee.ToString("N2")); em.Tip = ToUSD(cart.DriverTip.ToString("N2")); em.DriveName = base.CurrentOrder.DriverName; em.CouponChoice = base.CurrentOrder.CouponChoice; em.Instruction = base.CurrentOrder.CustomerMessage; em.Total = Helper.FormatPriceWithDollar(cart.Total()); // ToUSD(cart.Total().ToString("N2")); ec.FromEmailAddress = Globals.Settings.ContactForm.MailFrom; ec.FromName = "FoodReady.Net"; ec.Subject = "New online order"; ec.To = Globals.Settings.ContactForm.MailTo; // send to FoodReady.Net ec.Body = em.BuildEmailHtmlBodyForOrder(); em.FaxBody = em.BuildFaxHtmlBodyForOrder(); em.SendFax(bi.Fax); em.Send(ec); // ec.To = base.CurrentOrder.Email; // send to user //em.Send(ec); ec.To = bi.ContactInfo.Email; // send to restaurant em.Send(ec); }
public ActionResult DoRVCancel(int id) // id=ReservationId { bool sendSuccess = false; Reservation r = new Reservation(); r = ReservationRepository.GetReservationById(id); BizInfo bi = BizInfoRepository.GetBizInfoById(r.BizRVInfo.BizInfoId); if (r.Active) { ReservationRepository.LockReservation(r); EmailManager em = new EmailManager(); EmailContents ec = new EmailContents("FoodReady.Net", r.Email, Globals.Settings.ContactForm.MailFrom, "Reservation cancelled", EmailManager.BuildRVCancelToCustomer(r)); em.FaxBody = EmailManager.BuildRVCancelToRestaurant(r); em.SendFax(bi.Fax); em.Send(ec); // send to customer if (em.IsSent == false) { sendSuccess = false; TempData["sentCustomerMsg"] = "Your message has not been sent out for some reasons."; } else { sendSuccess = true; TempData["sentCustomerMsg"] = "Your message has been sent out successfully."; } ec.FromName = "FoodReady.Net"; ec.To = bi.ContactInfo.Email; // to restaurant; ec.FromEmailAddress = Globals.Settings.ContactForm.MailFrom; ec.Subject = "Reservation cancelled"; ec.Body = EmailManager.BuildRVCancelToRestaurant(r); em.Send(ec); if (em.IsSent == false) { sendSuccess = false; TempData["sentRestaurantMsg"] = "Your message has not been sent out for some reasons."; } else { sendSuccess = true; TempData["sentRestaurantMsg"] = "Your message has been sent out successfully."; } } ViewBag.SendingSuccess = sendSuccess; return(PartialView()); }
public void SendEmailToBoss(List <BizInfo> lcarts, string vTotal) { EmailManager em = new EmailManager(); EmailContents ec = new EmailContents(); em.OrderTime = DateTime.Now.ToShortTimeString() + " " + DateTime.Now.ToShortDateString(); em.OrderType = base.CurrentOrder.IsDelivery ? "Delivery" : "Pickup"; em.Total = vTotal; ec.FromEmailAddress = Globals.Settings.ContactForm.MailFrom; ec.FromName = "FoodReady.Net"; ec.Subject = "Your online order"; ec.To = base.CurrentOrder.Email; // send to boss ec.Body = em.BuildEmailHtmlOrderForBoss(lcarts); em.Send(ec); }
protected void commandRefund_Click(object sender, EventArgs e) { PayPalManager paypal = new PayPalManager(); paypal.RefundTransaction(Request.QueryString["TransID"]); Orders orders = new Orders(); ProcessUpdateOrder updateorder = new ProcessUpdateOrder(); int refundedstatustype = 3; orders.OrderID = int.Parse(Request.QueryString["OrderID"]); orders.OrderStatusID = refundedstatustype; orders.ShipDate = ( DateTime )SqlDateTime.Null; updateorder.Orders = orders; try { updateorder.Invoke(); if (paypal.IsSubmissionSuccess) { EmailManager emailmngr = new EmailManager(); EmailContents mailcontents = new EmailContents(); mailcontents.To = Request.QueryString["Email"]; mailcontents.Subject = "Little Italy Vineyard Update - Order ID: " + Request.QueryString["OrderID"]; mailcontents.Body = "Your order has been refunded. Please log into your account for details."; emailmngr.Send(mailcontents); if (!emailmngr.IsSent) { Response.Redirect("../ErrorPage.aspx"); } } } catch { Response.Redirect("../ErrorPage.aspx"); } Response.Redirect("Orders.aspx"); }
public async Task <ActionResult> ForgotPassword(ForgotPasswordViewModel model, ShoppingCart cart) { ViewBag.bagitems = GetCartItems(cart); if (ModelState.IsValid) { var user = await UserManager.FindByNameAsync(model.Email); if (user == null || !(await UserManager.IsEmailConfirmedAsync(user.Id))) { // Don't reveal that the user does not exist or is not confirmed return(View("ForgotPasswordConfirmation")); } var code = await UserManager.GeneratePasswordResetTokenAsync(user.Id); var callbackUrl = Url.Action("ResetPassword", "Account", new { userId = user.Id, code = code }, protocol: Request.Url.Scheme); EmailManager em = new EmailManager(); EmailContents ec = new EmailContents(); ec.FromEmailAddress = Globals.Settings.ContactForm.MailFrom; ec.FromName = "FoodReady.Net"; ec.Subject = "Reset Password for your foodready.net account"; ec.To = model.Email; ec.Body = "Please reset your password by clicking here: <a href=\"" + callbackUrl + "\">link</a>"; try { em.Send(ec); } catch (Exception e) { ModelState.AddModelError("", "Issue sending email: " + e.Message); return(View(model)); } // await UserManager.SendEmailAsync(user.Id, "Reset Password", "Please reset your password by clicking here: <a href=\"" + callbackUrl + "\">link</a>"); ViewBag.Link = callbackUrl; return(View("ForgotPasswordConfirmation")); } // If we got this far, something failed, redisplay form return(View(model)); }
private void SendMessage() { if (IsValid) { EmailContents contents = new EmailContents(); contents.FromName = textName.Text; contents.FromEmailAddress = textEmail.Text; contents.Body = textComment.Text; contents.Subject = "Website Feedback"; EmailManager emailmngr = new EmailManager(); emailmngr.Send(contents); if (emailmngr.IsSent) { Response.Redirect("ContactUsConfirm.aspx"); } } }
public ActionResult EmailKey(EmailGroupKeyModel egkm, ShoppingCart cart) { HandleCart(cart); ViewBag.result = string.Empty; ViewBag.cartkey = cart.CartKey; if (ModelState.IsValid) { EmailManager em = new EmailManager(); EmailContents ec = new EmailContents(); ec.FromEmailAddress = Globals.Settings.ContactForm.MailFrom; ec.FromName = "FoodReady.Net"; ec.Subject = egkm.Name + " is inviting you to join food orderong"; ec.To = egkm.Email; // send to FoodReady.Net ec.Body = "<p>The group key:" + cart.CartKey + "</p><p>" + egkm.Message + "</p>"; em.Send(ec); ViewBag.result = "Email has been successfully sent."; } return(PartialView(egkm)); }
public ActionResult ReferRestaurant(ReferRestaurantModel model, ShoppingCart cart) { ViewBag.result = ""; if (ModelState.IsValid) { EmailManager em = new EmailManager(); EmailContents ec = new EmailContents(); ec.FromEmailAddress = model.YourEmail; ec.FromName = "Customer: " + model.YourName; ec.Subject = "Refer a restaurant"; ec.To = Globals.Settings.ContactForm.MailTo; // send to FoodReady.Net ec.Body = "Refer a restayrant by customer: " + model.YourName + "<br />Customer Email: " + model.YourEmail + "<br />Restaurant Name: " + model.RestaurantName + "<br />Restaurant Phone: " + model.RestaurantPhone + "<br />Restaurant City: " + model.RestaurantName + "<br />Restaurant State: " + model.RestaurantState; em.Send(ec); ViewBag.result = "Your message has been sent to foodready.net. Thank you so much for refering a restaurant. we will be adding the restaurant into our restaurant system."; } ViewBag.bagitems = GetCartItems(cart); return(View(model)); }
public ActionResult InfoSubmit(RestaurantJoinModel model) { bool sendSuccess = false; if (ModelState.IsValid) { //ViewBag.qqq = EmailManager.BuildPartnerInfoHtmlBody(model); EmailManager em = new EmailManager(); EmailContents ec = new EmailContents(model.Name, Globals.Settings.ContactForm.MailTo, model.Email, "Restaurant Application", EmailManager.BuildPartnerInfoHtmlBody(model)); em.FaxBody = EmailManager.BuildPartnerInfoHtmlBody(model); em.SendFax(WebConfigurationManager.AppSettings["OnlineFaxNumber"].ToString()); em.Send(ec); // send to foodready.net if (em.IsSent == false) { sendSuccess = false; TempData["SentIMEALMsg"] = "Your message has not been sent out for some reasons."; } else { sendSuccess = true; TempData["SentIMEALMsg"] = "Your message has been sent out successfully."; } ec = new EmailContents("Foodready.net", model.Email, Globals.Settings.ContactForm.MailTo, "Restaurant Application", EmailManager.BuildImealHtmlBody()); em.Send(ec); // send to Partner if (em.IsSent == false) { sendSuccess = false; TempData["SentPartnerMsg"] = "Your message has not been sent out for some reasons."; } else { sendSuccess = true; TempData["SentPartnerMsg"] = "Your message has been sent out successfully."; } } ViewBag.SendingSuccess = sendSuccess; return(PartialView(model)); }
public ActionResult Contact(ContactModel model, bool captchaValid, string mobile, string captchaErrorMessage) { ViewBag.servicephone = ServicePhone; TempData["SentIMEALMsg"] = ""; if (ModelState.IsValid) { if (string.IsNullOrEmpty(mobile) || mobile != "y") { if (!captchaValid) { ModelState.AddModelError("recaptcha", captchaErrorMessage); return(View(model)); } } bool sendSuccess = false; //ViewBag.qqq = EmailManager.BuildCustomerEmailBody(model); EmailManager em = new EmailManager(); EmailContents ec = new EmailContents(model.ContactName, Globals.Settings.ContactForm.MailTo, model.Email, "Customer Help", EmailManager.BuildCustomerEmailBody(model)); // em.FaxBody = EmailManager.BuildCustomerEmailBody(model); //em.SendFax(WebConfigurationManager.AppSettings["OnlineFaxNumber"].ToString()); em.Send(ec); // send to foodready.net if (em.IsSent == false) { sendSuccess = false; TempData["SentIMEALMsg"] = "Your message has not been sent out for some reasons."; } else { sendSuccess = true; TempData["SentIMEALMsg"] = "Your message has been sent out successfully."; } ViewBag.SendingSuccess = sendSuccess; return(View(model)); } return(View(model)); }
protected void commandUpdate_Click(object sender, EventArgs e) { Orders orders = new Orders(); ProcessUpdateOrder updateorder = new ProcessUpdateOrder(); orders.OrderID = int.Parse(Request.QueryString["OrderID"]); orders.OrderStatusID = int.Parse(dropdownlistOrderStatus.SelectedItem.Value); orders.ShipDate = Convert.ToDateTime(textShippedDate.Text); orders.TrackingNumber = textTrackingNumber.Text; updateorder.Orders = orders; try { updateorder.Invoke(); EmailManager emailmngr = new EmailManager(); EmailContents mailcontents = new EmailContents(); mailcontents.To = Request.QueryString["Email"]; mailcontents.Subject = "Little Italy Vineyard Update - Order ID: " + Request.QueryString["OrderID"]; mailcontents.Body = "Your order has been updated. Please log into your account for details."; emailmngr.Send(mailcontents); if (!emailmngr.IsSent) { Response.Redirect("../ErrorPage.aspx"); } } catch { Response.Redirect("../ErrorPage.aspx"); } Response.Redirect("Orders.aspx"); }
public ActionResult Completed(RVConfirmationModel model) { bool sendSuccess = false; if (ModelState.IsValid) { if (model.Message == "Please note that not all requests can be accommodated.") { model.Message = ""; } BizInfo bi = BizInfoRepository.GetBizInfoById(model.BizInfoId); BizRVInfo brv = bi.GetBizRVInfo; model.Bizinfo = bi; ViewBag.biztitle = bi.BizTitle; ViewBag.datetime = DateTime.Parse(model.RVDate).ToLongDateString() + " " + model.RVTime; Reservation r = ReservationRepository.AddReservation(0, brv.BizRVInfoId, model.FirstName, model.LastName, model.Phone, model.Email, model.RVDate, model.RVTime, model.RVNum, model.Message, DateTime.Now, model.FirstName + model.LastName, DateTime.Now, model.FirstName + model.LastName, true); if (r != null) { EmailManager em = new EmailManager(); EmailContents ec = new EmailContents("FoodReady.Net", model.Email, Globals.Settings.ContactForm.MailFrom, "Restaurant Reservation", EmailManager.BuildRVtoCustomerHtmlBody(model)); em.FaxBody = EmailManager.BuildRVtoRestaurantHtmlBody(model); em.SendFax(bi.Fax); em.Send(ec); // send to customer if (em.IsSent == false) { sendSuccess = false; TempData["sentCustomerMsg"] = "Your message has not been sent out for some reasons."; } else { sendSuccess = true; TempData["sentCustomerMsg"] = "Your message has been sent out successfully."; } ec.FromName = "FoodReady.Net"; ec.To = bi.ContactInfo.Email; // to restaurant; ec.FromEmailAddress = Globals.Settings.ContactForm.MailFrom; ec.Subject = "Restaurant Reservation"; ec.Body = EmailManager.BuildRVtoRestaurantHtmlBody(model); em.Send(ec); if (em.IsSent == false) { sendSuccess = false; TempData["sentRestaurantMsg"] = "Your message has not been sent out for some reasons."; } else { sendSuccess = true; TempData["sentRestaurantMsg"] = "Your message has been sent out successfully."; } } else { sendSuccess = false; TempData["addToDBMsg"] = "Adding reservation to database failed for some reasons."; } } ViewBag.SendingSuccess = sendSuccess; return(View(model)); }
public void EmailSendingTest() { IEmailService emailService = (IEmailService)ContextRegistry.GetContext()["EmailService"]; ManualResetEvent manualResetEvent = new ManualResetEvent(false); bool sendMail = emailService.SendMail("*****@*****.**", "BlancRock", EmailContents.GetActivationKeyMessage( "Bruce Wayne", "123456787654"), true); manualResetEvent.WaitOne(5000); Assert.IsTrue(sendMail); }
public bool DoCheckoutCompleted(BuyGiftCardModel model) { bool completed = false; NVPCodec decoderResults = new NVPCodec(); decoderResults = (NVPCodec)Session["result"]; TempData["OrderSummaryTitle"] = DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString(); // string res = Util.BuildResponse(Session["result"], Request.QueryString.Get("API"), "Thank you for your payment!"); int cardid = CreditCardRepository.GetCreditCardId(UserName, int.Parse(model.CardType), model.CardNumber, int.Parse(model.ExpirationMonth), int.Parse(model.ExpirationYear), int.Parse(model.SecurityCode)); if (cardid == 0) { cardid = AddCreditCardToDB(model).CreditCardId; } CreditCard cc = CreditCardRepository.GetCreditCardById(cardid); //Order od = AddOrderToDB(cart, decoderResults["TRANSACTIONID"].ToString(), false, 0, 0.0m); string code = Guid.NewGuid().ToString(); TempData["CardCode"] = code; DateTime dt = DateTime.Now; GiftCard gc = GiftCardRepository.AddGiftCard(0, code, CurrentUserID, cardid, 0, model.BuyerEmail, model.RecipientEmail, model.Amount, dt, model.Amount, 0.0m, 0.0m, dt, UserName, dt, UserName, true); EmailManager em = new EmailManager(); EmailContents ec = new EmailContents(); em.OrderTime = dt.ToShortTimeString() + " " + dt.ToShortDateString(); TempData["DeliveryAddress"] = ""; em.OrderType = "Buy Gift Card"; em.PaymentType = "Credit Card"; em.OrderNumber = code; //gift card code em.Name = UserName; em.Phone = model.Phone; em.IpAddress = base.CurrentUserIP; em.CreditCardType = cc.CreditCardType.Title; em.CreditCardNumber = "xxxx-xxxx-xxxx-" + cc.CreditCardNumber.Substring(cc.CreditCardNumber.Length - 4); em.ExpirationDate = cc.ExpirationMonth.ToString() + "/" + cc.ExpirationYear.ToString(); em.SecurityCode = "xx" + cc.SecurityCode.ToString().Substring(cc.SecurityCode.ToString().Length - 1); em.Instruction = model.Message; em.Total = Helper.FormatPriceWithDollar(decoderResults["AMT"].ToString()); // ToUSD(cart.Total().ToString("N2")); ec.FromEmailAddress = Globals.Settings.ContactForm.MailFrom; ec.FromName = "foodready.net"; ec.Subject = "New online order"; ec.To = model.RecipientEmail; ec.Body = em.BuildGiftCardEmailHtmlBody(model); //em.FaxBody = em.BuildGiftCardFaxHtmlBody(model); //em.SendFax(WebConfigurationManager.AppSettings["OnlineFaxNumber"].ToString()); em.Send(ec); ec.To = Globals.Settings.ContactForm.MailTo; em.Send(ec); if (em.IsSent == false) { completed = false; TempData["EmailSentMsg"] = ec.Body; // TempData["paymentResult"] = "SendEmail failed"; } else { completed = true; TempData["EmailSentMsg"] = ec.Body; //TempData["paymentResult"] = string.Empty; } return(completed); }
public ActionResult forgetPassword(string email) { //bool cv = CaptchaController.IsValidCaptchaValue(CaptchaValue.ToUpper()); //bool icv = InvisibleCaptchaValue == ""; //if (!cv || !icv) //{ // ModelState.AddModelError(string.Empty, "Captcha error."); // return View(); //} if (ModelState.IsValid) { personalDetail pDetail = (from dt in db2.personalDetails where dt.email == email.Trim() select dt).FirstOrDefault(); if (pDetail != null) { EmailContents emcon = new EmailContents(); emcon.To = email.Trim(); emcon.ToName = pDetail.name; emcon.Password = pDetail.password; emcon.FromName = "Myanmarcv.com. Pte.Ltd"; emcon.FromEmailAddress = "*****@*****.**"; Send(emcon); return RedirectToAction("passwordRecoveryMessage", new { msg = "yesemail" }); } else { return RedirectToAction("passwordRecoveryMessage", new { msg = "noemail" }); } } return View(); }
public ActionResult ChangeCompleted(int id, string rvDate, string rvTime, int rvNum, string Message) // id=ReservationId { bool sendSuccess = false; ViewBag.rvdate = rvDate; ViewBag.rvtime = rvTime; ViewBag.rvnum = rvNum; ViewBag.datetime = DateTime.Parse(rvDate).ToLongDateString() + " " + rvTime; if (Message == "Please note that not all requests can be accommodated.") { Message = ""; } Reservation oldRv = ReservationRepository.GetReservationById(id); ViewBag.datetime = DateTime.Parse(rvDate).ToLongDateString() + " " + rvTime; ReservationRepository.AddReservation(id, oldRv.BizRVInfoId, oldRv.FirstName, oldRv.LastName, oldRv.Phone, oldRv.Email, rvDate, rvTime, rvNum, Message, oldRv.AddedDate, oldRv.AddedBy, DateTime.Now, oldRv.UpdatedBy, true); Reservation r = ReservationRepository.GetReservationById(id); if (r != null) { EmailManager em = new EmailManager(); EmailContents ec = new EmailContents("FoodReady.Net", r.Email, Globals.Settings.ContactForm.MailFrom, "Reservation changed", EmailManager.BuildRVChangetoCustomer(r, oldRv)); em.FaxBody = EmailManager.BuildRVChangetoRestaurant(r, oldRv); em.SendFax(r.BizRVInfo.BizInfo.Fax); em.Send(ec); // send to customer if (em.IsSent == false) { sendSuccess = false; TempData["sentCustomerMsg"] = "Your message has not been sent out for some reasons."; } else { sendSuccess = true; TempData["sentCustomerMsg"] = "Your message has been sent out successfully."; } ec.FromName = "FoodReady.Net"; ec.To = r.BizRVInfo.BizInfo.ContactInfo.Email; // to restaurant; ec.FromEmailAddress = Globals.Settings.ContactForm.MailFrom; ec.Subject = "Reservation changed"; ec.Body = EmailManager.BuildRVChangetoRestaurant(r, oldRv); em.Send(ec); if (em.IsSent == false) { sendSuccess = false; TempData["sentRestaurantMsg"] = "Your message has not been sent out for some reasons."; } else { sendSuccess = true; TempData["sentRestaurantMsg"] = "Your message has been sent out successfully."; } } else { sendSuccess = false; TempData["addToDBMsg"] = "Adding reservation to database failed for some reasons."; } ViewBag.SendingSuccess = sendSuccess; return(View(oldRv)); }
public bool Send(EmailContents emailcontents) { SmtpClient smtpClient = new SmtpClient("smtp.gmail.com", 587); smtpClient.Credentials = new System.Net.NetworkCredential("*****@*****.**", "mmcv@dmin"); StringBuilder sb = new StringBuilder(); string strhostname = System.Net.Dns.GetHostName(); sb.AppendLine("<div>Dear " + emailcontents.ToName + ","); sb.Append("<br /> <br />"); sb.Append(" Below is your personal details for password recovery. <br />"); sb.Append("Login ID : "); sb.Append(emailcontents.To); sb.Append("<br />"); sb.Append("Password : "******"<br />"); sb.Append("Please click the link for login : <span style='text-decoration:underline;'>" + "<a href="+"http://www.myanmarcv.com/account/forgetpassword>" +" www.myanmarcv.com" + "</a>"+"</span><br/>"); sb.Append("Thank you so much. <br/>"); sb.Append(emailcontents.FromName); sb.Append("</div>"); //string fullEmailContent = emailcontents.Body; //fullEmailContent = fullEmailContent.Replace("#raterName#", emailcontents.ToName); //fullEmailContent = fullEmailContent.Replace("#subjectName#", emailcontents.FromName); //fullEmailContent = fullEmailContent.Replace("#projectLink#", emailcontents.webHostLink + "raterHandler.ashx?InvitationID=" + emailcontents.InvitationCode); MailAddress from = new MailAddress(emailcontents.FromEmailAddress, emailcontents.FromName); MailAddress to = new MailAddress(emailcontents.To); MailMessage message = new MailMessage(from, to); message.Subject = "Password Recovery from MyanmarCV.com"; //emailcontents.Subject; message.Priority = MailPriority.High; message.IsBodyHtml = true; message.Body = sb.ToString(); //fullEmailContent; //sb.ToString(); //Utilities.FormatText(emailcontents.Body, true); smtpClient.EnableSsl = true; try { smtpClient.Send(message); return true; } catch (Exception ex) { throw ex; } }