refactor(email): allow custom email recipients in email sending logic
This commit is contained in:
@@ -12,6 +12,7 @@ class EmailChannel
|
||||
public function send(SendsEmail $notifiable, Notification $notification): void
|
||||
{
|
||||
$useInstanceEmailSettings = $notifiable->emailNotificationSettings->use_instance_email_settings;
|
||||
$customEmails = data_get($notification, 'emails', null);
|
||||
if ($useInstanceEmailSettings) {
|
||||
$settings = instanceSettings();
|
||||
} else {
|
||||
@@ -19,7 +20,11 @@ class EmailChannel
|
||||
}
|
||||
$isResendEnabled = $settings->resend_enabled;
|
||||
$isSmtpEnabled = $settings->smtp_enabled;
|
||||
$recipients = $notifiable->getRecipients();
|
||||
if ($customEmails) {
|
||||
$recipients = [$customEmails];
|
||||
} else {
|
||||
$recipients = $notifiable->getRecipients();
|
||||
}
|
||||
$mailMessage = $notification->toMail($notifiable);
|
||||
|
||||
if ($isResendEnabled) {
|
||||
|
@@ -14,7 +14,7 @@
|
||||
<x-modal-input buttonTitle="Send Test Email" title="Send Test Email">
|
||||
<form wire:submit.prevent="sendTestEmail" class="flex flex-col w-full gap-2">
|
||||
<x-forms.input wire:model="testEmailAddress" placeholder="test@example.com"
|
||||
id="testEmailAddress" label="Recipients" required />
|
||||
id="testEmailAddress" label="Recipient" required />
|
||||
<x-forms.button type="submit" @click="modalOpen=false">
|
||||
Send Email
|
||||
</x-forms.button>
|
||||
|
Reference in New Issue
Block a user