Пример #1
0
        public static void SendNotifications(Order order)
        {
            Sender EmailSender = new Sender
                (
                    host: "smtp.gmail.com",
                    port: 587,
                    enableSsl: true,
                    deliveryMethod: SmtpDeliveryMethod.Network,
                    useDefaultCredentials: false,
                    credentials: new NetworkCredential("*****@*****.**", "aspnetbu")
                );

            SendNotificationToCustomer(order, EmailSender);
            SendNotificationToShop(order, EmailSender);
        }
Пример #2
0
        public static bool SendNotificationToShop(Order order, Sender EmailSender)
        {
            string subject = $"New order {Convert.ToString(order.Date)}!";
            string body = GetMessageForShop(order);
            string toAddress = "*****@*****.**";

            try
            {
                EmailSender.SendMail(subject, body, toAddress);
                return true;
            }
            catch
            {
                return false;
            }

        }
Пример #3
0
        public static bool SendNotificationToCustomer(Order order, Sender EmailSender)
        {
            string subject = "MasterShop — New order";
            string body = GetMessageForCustomer(order);
            string toAddress = order.Customer.Email;

            try
            {
                EmailSender.SendMail(subject, body, toAddress);
                return true;
            }
            catch
            {
                return false;
            }
            
        }