Show error notice when email is sent from unauthorized email

[MAILPOET-1787]
This commit is contained in:
Ján Mikláš
2019-02-19 16:45:47 +01:00
committed by M. Shull
parent 79bd178123
commit f5feb032fe
8 changed files with 56 additions and 10 deletions

View File

@ -1,6 +1,7 @@
<?php
namespace MailPoet\Config;
use MailPoet\Mailer\MailerError;
use MailPoet\Models\Subscriber;
use MailPoet\Services\Bridge;
use MailPoet\Settings\SettingsController;
@ -115,4 +116,17 @@ class ServicesChecker {
return false;
}
function isFromEmailAuthorized($display_error_notice = true) {
$mta_log_error = $this->settings->get('mta_log.error', []);
if ($mta_log_error && $mta_log_error['operation'] === MailerError::OPERATION_AUTHORIZATION) {
if ($display_error_notice) {
WPNotice::displayError($mta_log_error['error_message'], 'js-error-unauthorized-email', '', false, false);
}
return false;
}
return true;
}
}