Skip to content

Beautiful Open-Source Form Builder

Enhance email settings configuration with encryption options

JhumanJ916d2888745f
diff --git a/api/app/Http/Requests/Workspace/EmailSettingsRequest.php b/api/app/Http/Requests/Workspace/EmailSettingsRequest.php
index 72b18a212..6aaa0117b 100644
--- a/api/app/Http/Requests/Workspace/EmailSettingsRequest.php
+++ b/api/app/Http/Requests/Workspace/EmailSettingsRequest.php
@@ -35,6 +35,10 @@ class EmailSettingsRequest extends FormRequest
'required_with:host,username,password,sender_address',
'integer',
],
+ 'encryption' => [
+ 'nullable',
+ 'in:tls,ssl',
+ ],
'username' => [
$allFieldsPresent ? 'required' : 'nullable',
'required_with:host,port,password,sender_address',
diff --git a/api/app/Notifications/Forms/FormEmailNotification.php b/api/app/Notifications/Forms/FormEmailNotification.php
index 89835fe8a..6f21a772b 100644
--- a/api/app/Notifications/Forms/FormEmailNotification.php
+++ b/api/app/Notifications/Forms/FormEmailNotification.php
@@ -41,6 +41,7 @@ class FormEmailNotification extends Notification
config([
'mail.mailers.custom_smtp.host' => $emailSettings['host'],
'mail.mailers.custom_smtp.port' => $emailSettings['port'],
+ 'mail.mailers.custom_smtp.encryption' => array_key_exists('encryption', $emailSettings) ? $emailSettings['encryption'] : 'tls',
'mail.mailers.custom_smtp.username' => $emailSettings['username'],
'mail.mailers.custom_smtp.password' => $emailSettings['password']
]);
diff --git a/api/config/mail.php b/api/config/mail.php
index 053abc4fd..e0c1d91e7 100644
--- a/api/config/mail.php
+++ b/api/config/mail.php
@@ -46,12 +46,12 @@ return [
],
// Use the custom_smtp mailer for the user's own SMTP server.
- // This configuration will be set dynamically by the AbstractEmailIntegrationHandler class.
+ // This configuration will be set dynamically by FormEmailNotification.
'custom_smtp' => [
'transport' => 'smtp',
'host' => null,
- 'port' => 587,
- 'encryption' => 'tls',
+ 'port' => null,
+ 'encryption' => null,
'username' => null,
'password' => null,
],
diff --git a/client/components/workspaces/settings/Emails.vue b/client/components/workspaces/settings/Emails.vue
index 581a0cbc6..17a4e99dc 100644
--- a/client/components/workspaces/settings/Emails.vue
+++ b/client/components/workspaces/settings/Emails.vue
@@ -55,6 +55,15 @@
label="Port"
placeholder="587"
/>
+ <OptionSelectorInput
+ :form="emailSettingsForm"
+ name="encryption"
+ :disabled="!workspace.is_pro"
+ label="Encryption"
+ :options="encryptionOptions"
+ :columns="3"
+ seamless
+ />
<TextInput
:form="emailSettingsForm"
name="username"
@@ -116,9 +125,16 @@ const openSubscriptionModal = () => {
openModal({ modal_title: 'Upgrade to send emails using your own domain' })
}
+const encryptionOptions = [
+ { name: 'tls', label: 'TLS' },
+ { name: 'ssl', label: 'SSL' },
+ { name: 'none', label: 'None' }
+]
+
const emailSettingsForm = useForm({
host: '',
port: '',
+ encryption: 'tls',
username: '',
password: '',
sender_address: ''
@@ -147,6 +163,7 @@ const saveChanges = () => {
data: {
host: emailSettingsForm?.host,
port: emailSettingsForm?.port,
+ encryption: emailSettingsForm?.encryption === 'none' ? null : emailSettingsForm?.encryption,
username: emailSettingsForm?.username,
password: emailSettingsForm?.password,
sender_address: emailSettingsForm?.sender_address,
@@ -166,6 +183,7 @@ const initEmailSettings = () => {
const emailSettings = workspace.value?.settings?.email_settings
emailSettingsForm.host = emailSettings?.host
emailSettingsForm.port = emailSettings?.port
+ emailSettingsForm.encryption = emailSettings?.encryption === null ? 'none' : (emailSettings?.encryption || 'tls')
emailSettingsForm.username = emailSettings?.username
emailSettingsForm.password = emailSettings?.password
emailSettingsForm.sender_address = emailSettings?.sender_address