Fix: Allow test emails to be sent to any email address (#7600)
This commit is contained in:
commit
c1380e7dba
3 changed files with 24 additions and 15 deletions
|
|
@ -43,21 +43,26 @@ public function send(SendsEmail $notifiable, Notification $notification): void
|
||||||
throw new Exception('No email recipients found');
|
throw new Exception('No email recipients found');
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($recipients as $recipient) {
|
// Skip team membership validation for test notifications
|
||||||
// Check if the recipient is part of the team
|
$isTestNotification = data_get($notification, 'isTestNotification', false);
|
||||||
if (! $members->contains('email', $recipient)) {
|
|
||||||
$emailSettings = $notifiable->emailNotificationSettings;
|
if (! $isTestNotification) {
|
||||||
data_set($emailSettings, 'smtp_password', '********');
|
foreach ($recipients as $recipient) {
|
||||||
data_set($emailSettings, 'resend_api_key', '********');
|
// Check if the recipient is part of the team
|
||||||
send_internal_notification(sprintf(
|
if (! $members->contains('email', $recipient)) {
|
||||||
"Recipient is not part of the team: %s\nTeam: %s\nNotification: %s\nNotifiable: %s\nEmail Settings:\n%s",
|
$emailSettings = $notifiable->emailNotificationSettings;
|
||||||
$recipient,
|
data_set($emailSettings, 'smtp_password', '********');
|
||||||
$team,
|
data_set($emailSettings, 'resend_api_key', '********');
|
||||||
get_class($notification),
|
send_internal_notification(sprintf(
|
||||||
get_class($notifiable),
|
"Recipient is not part of the team: %s\nTeam: %s\nNotification: %s\nNotifiable: %s\nEmail Settings:\n%s",
|
||||||
json_encode($emailSettings, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)
|
$recipient,
|
||||||
));
|
$team,
|
||||||
throw new Exception('Recipient is not part of the team');
|
get_class($notification),
|
||||||
|
get_class($notifiable),
|
||||||
|
json_encode($emailSettings, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)
|
||||||
|
));
|
||||||
|
throw new Exception('Recipient is not part of the team');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,8 @@ class Test extends Notification implements ShouldQueue
|
||||||
|
|
||||||
public $tries = 5;
|
public $tries = 5;
|
||||||
|
|
||||||
|
public bool $isTestNotification = true;
|
||||||
|
|
||||||
public function __construct(public ?string $emails = null, public ?string $channel = null, public ?bool $ping = false)
|
public function __construct(public ?string $emails = null, public ?string $channel = null, public ?bool $ping = false)
|
||||||
{
|
{
|
||||||
$this->onQueue('high');
|
$this->onQueue('high');
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,8 @@
|
||||||
|
|
||||||
class Test extends CustomEmailNotification
|
class Test extends CustomEmailNotification
|
||||||
{
|
{
|
||||||
|
public bool $isTestNotification = true;
|
||||||
|
|
||||||
public function __construct(public string $emails, public bool $isTransactionalEmail = true)
|
public function __construct(public string $emails, public bool $isTransactionalEmail = true)
|
||||||
{
|
{
|
||||||
$this->onQueue('high');
|
$this->onQueue('high');
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue