Browse Source

Send simple email notifycation on new order

Vova Tkach 5 years ago
parent
commit
3ce21dc82c
1 changed files with 11 additions and 0 deletions
  1. 11 0
      modules/module_shop_act_order.go

+ 11 - 0
modules/module_shop_act_order.go

@@ -141,6 +141,17 @@ func (this *Modules) RegisterAction_ShopOrder() *Action {
 				}
 			}
 
+			// Send notify email
+			if (*wrap.Config).Shop.Orders.NotifyEmail != "" {
+				if err := wrap.SendEmail(
+					(*wrap.Config).Shop.Orders.NotifyEmail,
+					"❤️ New Order ("+wrap.CurrHost+")",
+					"You have new order in shop on host: "+wrap.CurrHost,
+				); err != nil {
+					return err
+				}
+			}
+
 			return nil
 		}); err != nil {
 			wrap.Write(`{"error": true, "variable": "ShopOrderErrorSomethingWrong"}`)