Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

fix: test emails only available for user owned smtp/resend

Andras Bacsaid32e43ef37c1
diff --git a/bootstrap/helpers/shared.php b/bootstrap/helpers/shared.php
index ee1e4fe2b7..181e26348c 100644
--- a/bootstrap/helpers/shared.php
+++ b/bootstrap/helpers/shared.php
@@ -343,6 +343,10 @@ function send_user_an_email(MailMessage $mail, string $email, ?string $cc = null
);
}
}
+function isTestEmailEnabled($notifiable)
+{
+ return data_get($notifiable, 'smtp_enabled') || data_get($notifiable, 'resend_enabled');
+}
function isEmailEnabled($notifiable)
{
return data_get($notifiable, 'smtp_enabled') || data_get($notifiable, 'resend_enabled') || data_get($notifiable, 'use_instance_email_settings');
diff --git a/resources/views/livewire/notifications/email-settings.blade.php b/resources/views/livewire/notifications/email-settings.blade.php
index 8734b3c608..61c81dfa35 100644
--- a/resources/views/livewire/notifications/email-settings.blade.php
+++ b/resources/views/livewire/notifications/email-settings.blade.php
@@ -22,7 +22,8 @@
</x-forms.button>
@endif
@if (isEmailEnabled($team) &&
- auth()->user()->isAdminFromSession())
+ auth()->user()->isAdminFromSession() &&
+ isTestEmailEnabled($team))
<x-forms.button onclick="sendTestEmail.showModal()"
class="text-white normal-case btn btn-xs no-animation btn-primary">
Send Test Email
diff --git a/resources/views/livewire/settings/email.blade.php b/resources/views/livewire/settings/email.blade.php
index 09fa6097c9..3758ca3739 100644
--- a/resources/views/livewire/settings/email.blade.php
+++ b/resources/views/livewire/settings/email.blade.php
@@ -22,7 +22,9 @@
<x-forms.button type="submit">
Save
</x-forms.button>
- @if (isEmailEnabled($settings))
+ @if (isEmailEnabled($settings) &&
+ auth()->user()->isAdminFromSession() &&
+ isTestEmailEnabled($settings))
<x-forms.button onclick="sendTestEmail.showModal()"
class="text-white normal-case btn btn-xs no-animation btn-primary">
Send Test Email