refactor(Email): streamline SMTP and resend settings handling in copyFromInstanceSettings method
This commit is contained in:
@@ -337,11 +337,14 @@ class Email extends Component
|
|||||||
public function copyFromInstanceSettings()
|
public function copyFromInstanceSettings()
|
||||||
{
|
{
|
||||||
$settings = instanceSettings();
|
$settings = instanceSettings();
|
||||||
|
$this->smtpFromAddress = $settings->smtp_from_address;
|
||||||
|
$this->smtpFromName = $settings->smtp_from_name;
|
||||||
|
|
||||||
if ($settings->smtp_enabled) {
|
if ($settings->smtp_enabled) {
|
||||||
$this->smtpEnabled = true;
|
$this->smtpEnabled = true;
|
||||||
$this->smtpFromAddress = $settings->smtp_from_address;
|
$this->resendEnabled = false;
|
||||||
$this->smtpFromName = $settings->smtp_from_name;
|
}
|
||||||
|
|
||||||
$this->smtpRecipients = $settings->smtp_recipients;
|
$this->smtpRecipients = $settings->smtp_recipients;
|
||||||
$this->smtpHost = $settings->smtp_host;
|
$this->smtpHost = $settings->smtp_host;
|
||||||
$this->smtpPort = $settings->smtp_port;
|
$this->smtpPort = $settings->smtp_port;
|
||||||
@@ -349,20 +352,14 @@ class Email extends Component
|
|||||||
$this->smtpUsername = $settings->smtp_username;
|
$this->smtpUsername = $settings->smtp_username;
|
||||||
$this->smtpPassword = $settings->smtp_password;
|
$this->smtpPassword = $settings->smtp_password;
|
||||||
$this->smtpTimeout = $settings->smtp_timeout;
|
$this->smtpTimeout = $settings->smtp_timeout;
|
||||||
$this->resendEnabled = false;
|
|
||||||
$this->saveModel();
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if ($settings->resend_enabled) {
|
if ($settings->resend_enabled) {
|
||||||
$this->resendEnabled = true;
|
$this->resendEnabled = true;
|
||||||
$this->resendApiKey = $settings->resend_api_key;
|
|
||||||
$this->smtpEnabled = false;
|
$this->smtpEnabled = false;
|
||||||
|
}
|
||||||
|
$this->resendApiKey = $settings->resend_api_key;
|
||||||
$this->saveModel();
|
$this->saveModel();
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
$this->dispatch('error', 'Instance SMTP/Resend settings are not enabled.');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function render()
|
public function render()
|
||||||
|
Reference in New Issue
Block a user