error send message email after confirm order (web services )

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
6 years ago
hi developer
what the problem in code , body not display message

        public ActionResult send(String name, String email, String title, object content)
        {
            MailMessage msg = new MailMessage();
            StringBuilder sb_content = new StringBuilder();
            sb_content.Append("<h3>Message : " + title + "</h3>");
            sb_content.Append("<p><b>From</b> : " + name + "</p>");
            sb_content.Append("<p><b>Email</b> : " + email + "</p>");
            sb_content.Append("<p><b>Subject</b> : " + content + "</p>");

            msg.From = new MailAddress("[email protected]");
            msg.To.Add(email);
            msg.Subject = title;
            msg.IsBodyHtml = true;
            SmtpClient client = new SmtpClient();
            client.UseDefaultCredentials = true;
            client.Host = "outlook.office365.com";
            client.Port = 587;
            client.EnableSsl = true;
            client.DeliveryMethod = SmtpDeliveryMethod.Network;
            client.Credentials = new NetworkCredential("[email protected]", "xxxpassword");
           // client.Timeout = 1000;
            try
            {
                client.Send(msg);
                return Successful("Mail has been successfully sent!");
            }
            catch (Exception ex)
            {
                return ErrorOccured("Fail Has error" + ex.Message);
            }
            finally
            {
                msg.Dispose();
            }
        }

/////////////////////////////////////////////////

        public ActionResult CheckOut(string apitoken,  string Name , string Phone ,string Email , string Address , string City ,int Country , string ZipCode)
        {

            if (!IsApiTokenValid(apitoken))
                return InvalidApiToken(apitoken);

            if (String.IsNullOrWhiteSpace(Email))
                return ErrorOccured("Email is empty.");

            if (String.IsNullOrWhiteSpace(Name))
                return ErrorOccured("Name is empty.");

            if (String.IsNullOrWhiteSpace(Phone))
                return ErrorOccured("Phone is empty.");

            if (String.IsNullOrWhiteSpace(Address))
                return ErrorOccured("Address is empty.");

            if (String.IsNullOrWhiteSpace(City))
                return ErrorOccured("City is empty.");

            if (String.IsNullOrWhiteSpace(ZipCode))
                return ErrorOccured("ZipCode is empty.");

            var customer = _customerService.GetCustomerByEmail(Email);

            object  result  =  GetCartJson(customer, ShoppingCartType.ShoppingCart);


            var address = new Address()
            {
                FirstName = Name,
                PhoneNumber = Phone,
                Address1 = Address,
                City = City,
                Email = Email,
                CountryId = Country,
                ZipPostalCode = ZipCode,


        };
            

            if (address != null)
            {
                _workContext.CurrentCustomer.ShippingAddress = address;
                send(address.FirstName, "[email protected]", "New Order", result );
                return Successful(GetAddressJson(address));
             }
            else
            {
                return ErrorOccured("Sorry Try Again");
            }
          
        }

///////////////////////////////////////////

        private object GetCartJson(Customer customer , ShoppingCartType type)
        {
            
            var shoppingCartItem = customer.ShoppingCartItems
                .Where(c => c.ShoppingCartType == type)
                .Select(c =>
                    new
                    {
                        Product = GetProductJson(c.Product),
                        Quantity = c.Quantity
                                                
                        
                    });
            return shoppingCartItem;
        }

////////////////////////////////////////
6 years ago
What is the error message you getting?
6 years ago
seanrock wrote:
What is the error message you getting?



System.Linq.Enumerable+WhereSelectListIterator`2[Nop.Core.Domain.Orders.ShoppingCartItem,<>f__AnonymousType2`2[System.Object,System.Int32
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.