This commit is contained in:
Andras Bacsai 2023-06-12 12:52:58 +02:00
parent 19a83bb2c0
commit d80b0f77c5
3 changed files with 9 additions and 3 deletions

View File

@ -16,7 +16,7 @@ class EmailSettings extends Component
'model.extra_attributes.smtp_active' => 'nullable|boolean',
'model.extra_attributes.smtp_from_address' => 'required|email',
'model.extra_attributes.smtp_from_name' => 'required',
'model.extra_attributes.smtp_recipients' => 'required',
'model.extra_attributes.smtp_recipients' => 'nullable',
'model.extra_attributes.smtp_host' => 'required',
'model.extra_attributes.smtp_port' => 'required',
'model.extra_attributes.smtp_encryption' => 'nullable',

View File

@ -11,11 +11,15 @@ class EmailChannel
public function send(SendsEmail $notifiable, Notification $notification): void
{
$this->bootConfigs($notifiable);
$is_test_notification = $notification instanceof \App\Notifications\TestNotification;
if ($is_test_notification) {
$bcc = $notifiable->routeNotificationForEmail('smtp_test_recipients');
if (count($bcc) === 0) {
if ($notifiable instanceof \App\Models\Team) {
$bcc = $notifiable->members()->pluck('email')->toArray();
}
}
} else {
$bcc = $notifiable->routeNotificationForEmail();
}

View File

@ -22,9 +22,11 @@
</div>
<div class="flex gap-2">
<x-forms.input required id="model.extra_attributes.smtp_recipients"
<x-forms.input id="model.extra_attributes.smtp_recipients"
placeholder="If empty, all users will be notified in the team."
helper="Email list to send the all notifications to, separated by comma." label="Recipient(s)" />
<x-forms.input id="model.extra_attributes.smtp_test_recipients" label="Test Notification Recipient(s)"
placeholder="If empty, all users will be notified in the team."
helper="Email list to send the test notification to, separated by comma." />
</div>
<div class="flex flex-col gap-2 xl:flex-row">