refactor(email): allow custom email recipients in email sending logic
This commit is contained in:
parent
6d9887afba
commit
ebb81aff68
2 changed files with 7 additions and 2 deletions
|
|
@ -12,6 +12,7 @@ public function __construct() {}
|
|||
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 @@ public function send(SendsEmail $notifiable, Notification $notification): void
|
|||
}
|
||||
$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>
|
||||
|
|
|
|||
Loading…
Reference in a new issue