From d01805a9118bf4d9ae2517e8b7adfd0fb61d585e Mon Sep 17 00:00:00 2001 From: Pavel Dohnal Date: Mon, 15 Oct 2018 11:18:53 +0200 Subject: [PATCH] Add default notification email [MAILPOET-1522] --- lib/Config/Populator.php | 6 +++++- lib/Subscribers/SendNewSubscriberNotification.php | 3 +++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/Config/Populator.php b/lib/Config/Populator.php index f46dd452d2..1915b0012c 100644 --- a/lib/Config/Populator.php +++ b/lib/Config/Populator.php @@ -173,7 +173,11 @@ class Populator { $subscriber_email_notification = Setting::getValue(SendNewSubscriberNotification::SETTINGS_KEY); if(empty($subscriber_email_notification)) { - Setting::setValue('subscriber_email_notification', ['enabled' => true]); + $sender = Setting::getValue('sender', []); + Setting::setValue('subscriber_email_notification', [ + 'enabled' => true, + 'address' => isset($sender['address'])? $sender['address'] : null, + ]); } // reset mailer log diff --git a/lib/Subscribers/SendNewSubscriberNotification.php b/lib/Subscribers/SendNewSubscriberNotification.php index b98acaff6c..ef49b1c760 100644 --- a/lib/Subscribers/SendNewSubscriberNotification.php +++ b/lib/Subscribers/SendNewSubscriberNotification.php @@ -68,6 +68,9 @@ class SendNewSubscriberNotification { if(!isset($settings['address'])) { return true; } + if(empty(trim($settings['address']))) { + return true; + } return !(bool)$settings['enabled']; }