Skip to content

Commit

Permalink
Adds support for testToEmailAddress arrays
Browse files Browse the repository at this point in the history
  • Loading branch information
BenParizek committed May 25, 2024
1 parent aa7c40e commit ce4071e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions src/mailer/components/mailers/SystemMailer.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,11 @@ public function getSendTestModalHtml(EmailElement $email): string
{
$testToEmailAddress = Craft::$app->getConfig()->getGeneral()->testToEmailAddress;

if ($testToEmailAddress) {
if (!empty($testToEmailAddress)) {
$warningMessage = Craft::t('sprout-module-mailer', 'Test email found in general config. All messages will be sent to the testToEmailAddress: {email}', [
'email' => $testToEmailAddress,
'email' => is_array($testToEmailAddress)
? implode(', ', $testToEmailAddress)
: $testToEmailAddress,
]);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ public function formHtml(?ElementInterface $element = null, bool $static = false
$id = sprintf('warning%s', mt_rand());

$message = Markdown::process(Html::encode(Craft::t('sprout-module-mailer', 'Test email found in general config. All messages will be sent to the testToEmailAddress: {email}', [
'email' => $testToEmailAddress,
'email' => is_array($testToEmailAddress)
? implode(', ', $testToEmailAddress)
: $testToEmailAddress,
])));

$blockquote = Html::tag('blockquote', $message, [
Expand All @@ -39,6 +41,6 @@ public function formHtml(?ElementInterface $element = null, bool $static = false
'class' => 'readable',
]);

return $testToEmailAddress ? $html : null;
return !empty($testToEmailAddress) ? $html : null;
}
}

0 comments on commit ce4071e

Please sign in to comment.