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.

refactor(Email): streamline SMTP and resend settings handling in copyFromInstanceSettings method

Andras Bacsaide839e3fcb78
diff --git a/app/Livewire/Notifications/Email.php b/app/Livewire/Notifications/Email.php
index 3ed20f907c..3b732af995 100644
--- a/app/Livewire/Notifications/Email.php
+++ b/app/Livewire/Notifications/Email.php
@@ -337,32 +337,29 @@ class Email extends Component
public function copyFromInstanceSettings()
{
$settings = instanceSettings();
+ $this->smtpFromAddress = $settings->smtp_from_address;
+ $this->smtpFromName = $settings->smtp_from_name;
if ($settings->smtp_enabled) {
$this->smtpEnabled = true;
- $this->smtpFromAddress = $settings->smtp_from_address;
- $this->smtpFromName = $settings->smtp_from_name;
- $this->smtpRecipients = $settings->smtp_recipients;
- $this->smtpHost = $settings->smtp_host;
- $this->smtpPort = $settings->smtp_port;
- $this->smtpEncryption = $settings->smtp_encryption;
- $this->smtpUsername = $settings->smtp_username;
- $this->smtpPassword = $settings->smtp_password;
- $this->smtpTimeout = $settings->smtp_timeout;
$this->resendEnabled = false;
- $this->saveModel();
-
- return;
}
+
+ $this->smtpRecipients = $settings->smtp_recipients;
+ $this->smtpHost = $settings->smtp_host;
+ $this->smtpPort = $settings->smtp_port;
+ $this->smtpEncryption = $settings->smtp_encryption;
+ $this->smtpUsername = $settings->smtp_username;
+ $this->smtpPassword = $settings->smtp_password;
+ $this->smtpTimeout = $settings->smtp_timeout;
+
if ($settings->resend_enabled) {
$this->resendEnabled = true;
- $this->resendApiKey = $settings->resend_api_key;
$this->smtpEnabled = false;
- $this->saveModel();
-
- return;
}
- $this->dispatch('error', 'Instance SMTP/Resend settings are not enabled.');
+ $this->resendApiKey = $settings->resend_api_key;
+ $this->saveModel();
+
}
public function render()