diff --git a/BTCPayServer/Controllers/UIStoresController.Email.cs b/BTCPayServer/Controllers/UIStoresController.Email.cs index 072b97cf1..b7f7e65c6 100644 --- a/BTCPayServer/Controllers/UIStoresController.Email.cs +++ b/BTCPayServer/Controllers/UIStoresController.Email.cs @@ -62,6 +62,14 @@ namespace BTCPayServer.Controllers return View(vm); } + + for (var i = 0; index < vm.Rules.Count; index++) + { + var rule = vm.Rules[i]; + if (!rule.CustomerEmail && string.IsNullOrEmpty(rule.To)) + ModelState.AddModelError($"{nameof(vm.Rules)}[{i}].{nameof(rule.To)}", "Either recipient or \"Send the email to the buyer\" is required"); + } + if (!ModelState.IsValid) { return View(vm); @@ -121,7 +129,6 @@ namespace BTCPayServer.Controllers public bool CustomerEmail { get; set; } - [Required] [MailboxAddress] public string To { get; set; } diff --git a/BTCPayServer/Views/UIStores/StoreEmails.cshtml b/BTCPayServer/Views/UIStores/StoreEmails.cshtml index 928baadc6..b21452f75 100644 --- a/BTCPayServer/Views/UIStores/StoreEmails.cshtml +++ b/BTCPayServer/Views/UIStores/StoreEmails.cshtml @@ -60,7 +60,7 @@