Prevent showing mailer errors to subscribers

[MAILPOET-2120]
This commit is contained in:
Pavel Dohnal
2019-06-26 13:38:00 +02:00
committed by M. Shull
parent f8e33bae70
commit 62a7d17582
2 changed files with 3 additions and 3 deletions

View File

@@ -117,12 +117,12 @@ class ConfirmationEmailMailer {
$this->mailer->getReplyToNameAndAddress($reply_to);
$result = $this->mailer->send($email, $subscriber);
if ($result['response'] === false) {
$subscriber->setError($result['error'] instanceof MailerError ? $result['error']->getMessage() : 'Unknown Error.');
$subscriber->setError(__('Something went wrong with your subscription. Please contact the website owner.', 'mailpoet'));
return false;
};
return true;
} catch (\Exception $e) {
$subscriber->setError($e->getMessage());
$subscriber->setError(__('Something went wrong with your subscription. Please contact the website owner.', 'mailpoet'));
return false;
}
}

View File

@@ -69,7 +69,7 @@ class ConfirmationEmailMailerTest extends \MailPoetTest {
$sender->sendConfirmationEmail($subscriber);
// error is set on the subscriber model object
expect($subscriber->getErrors()[0])->equals('send error');
expect($subscriber->getErrors()[0])->equals('Something went wrong with your subscription. Please contact the website owner.');
}
function testItDoesntSendWhenMSSIsActiveAndConfirmationEmailIsNotAuthorized() {