Only queue test mail for sending when the mailpoet sending method is updated

MAILPOET-4760
This commit is contained in:
Oluwaseun Olorunsola
2022-11-18 12:40:17 +01:00
committed by Aschepikov
parent 651e2d3c56
commit 9b9f61bf13

View File

@ -148,17 +148,6 @@ class Settings extends APIEndpoint {
$this->messageController->updateSuccessMessages();
}
$sendingMethodSet = $settings['mta']['method'] ?? null;
if ($sendingMethodSet === 'PHPMail') {
// check for valid mail function
$this->settings->set(DisabledMailFunctionNotice::QUEUE_DISABLED_MAIL_FUNCTION_CHECK, true);
} else {
// when the user switch to a new sending method
// do not display the DisabledMailFunctionNotice
$this->settings->set(DisabledMailFunctionNotice::QUEUE_DISABLED_MAIL_FUNCTION_CHECK, false);
$this->settings->set(DisabledMailFunctionNotice::OPTION_NAME, false); // do not display notice
}
// Tracking and re-engagement Emails
$meta['showNotice'] = false;
if ($oldSettings['tracking'] !== $this->settings->get('tracking')) {
@ -374,6 +363,19 @@ class Settings extends APIEndpoint {
$this->settingsChangeHandler->onMSSActivate($newSettings);
}
if (($oldSendingMethod !== $newSendingMethod)) {
$sendingMethodSet = $newSettings['mta']['method'] ?? null;
if ($sendingMethodSet === 'PHPMail') {
// check for valid mail function
$this->settings->set(DisabledMailFunctionNotice::QUEUE_DISABLED_MAIL_FUNCTION_CHECK, true);
} else {
// when the user switch to a new sending method
// do not display the DisabledMailFunctionNotice
$this->settings->set(DisabledMailFunctionNotice::QUEUE_DISABLED_MAIL_FUNCTION_CHECK, false);
$this->settings->set(DisabledMailFunctionNotice::OPTION_NAME, false); // do not display notice
}
}
// Sync WooCommerce Customers list
$oldSubscribeOldWoocommerceCustomers = isset($oldSettings['mailpoet_subscribe_old_woocommerce_customers']['enabled'])
? $oldSettings['mailpoet_subscribe_old_woocommerce_customers']['enabled']