Exemplo n.º 1
0
        internal void SendShippingEmail(Order order)
        {
            // send "shipping update" email...
            try
            {
                TokenHelper tokenHelper = new TokenHelper(this.storeContext);
                var         tokens      = tokenHelper.GetOrderTokens(order, true);

                EmailController emailer = new EmailController();
                emailer.SendEmailTemplate(EmailTemplateNames.ShippingUpdate, tokens, order.CustomerEmail, this.storeContext.CurrentStore);
            }
            catch (Exception ex)
            {
                Exceptions.LogException(ex);
            }
        }
        private void SendOrderEmails(CheckoutResult checkoutResult, Order submittedOrder, Dictionary <string, string> orderTokens)
        {
            try
            {
                EmailController emailController = new EmailController();

                string adminEmailResponse = emailController.SendEmailTemplate(EmailTemplateNames.OrderReceivedAdmin, orderTokens, storeContext.CurrentStore.GetSetting(StoreSettingNames.OrderCompletedEmailRecipient), storeContext.CurrentStore);
                if (WA.Parser.ToBool(storeContext.CurrentStore.GetSetting(StoreSettingNames.SendOrderReceivedEmail)).GetValueOrDefault(true))
                {
                    string emailResponse = emailController.SendEmailTemplate(EmailTemplateNames.OrderReceived, orderTokens, submittedOrder.CustomerEmail, storeContext.CurrentStore);

                    if (!string.IsNullOrEmpty(emailResponse))
                    {
                        checkoutResult.Warnings.Add(string.Format(@"Something went wrong when we tried to email your order receipt. {0}", emailResponse));
                    }
                }
            }
            catch (Exception ex)
            {
                checkoutResult.Warnings.Add(string.Format(@"Something went wrong when we tried to email your order receipt. {0}", ex.Message));
            }
        }