Merge pull request #4381 from vishwamartur/add-no-encryption-option

Add no encryption option for SMTP settings
This commit is contained in:
Andras Bacsai
2024-12-05 13:10:18 +01:00
committed by GitHub
5 changed files with 16 additions and 8 deletions

View File

@@ -37,7 +37,7 @@ class Email extends Component
#[Validate(['nullable', 'numeric'])] #[Validate(['nullable', 'numeric'])]
public ?int $smtpPort = null; public ?int $smtpPort = null;
#[Validate(['nullable', 'string'])] #[Validate(['nullable', 'string', 'in:tls,ssl,none'])]
public ?string $smtpEncryption = null; public ?string $smtpEncryption = null;
#[Validate(['nullable', 'string'])] #[Validate(['nullable', 'string'])]

View File

@@ -19,7 +19,7 @@ class SettingsEmail extends Component
#[Validate(['nullable', 'numeric', 'min:1', 'max:65535'])] #[Validate(['nullable', 'numeric', 'min:1', 'max:65535'])]
public ?int $smtpPort = null; public ?int $smtpPort = null;
#[Validate(['nullable', 'string'])] #[Validate(['nullable', 'string', 'in:tls,ssl,none'])]
public ?string $smtpEncryption = null; public ?string $smtpEncryption = null;
#[Validate(['nullable', 'string'])] #[Validate(['nullable', 'string'])]

View File

@@ -66,11 +66,12 @@ class EmailChannel
'transport' => 'smtp', 'transport' => 'smtp',
'host' => data_get($notifiable, 'smtp_host'), 'host' => data_get($notifiable, 'smtp_host'),
'port' => data_get($notifiable, 'smtp_port'), 'port' => data_get($notifiable, 'smtp_port'),
'encryption' => data_get($notifiable, 'smtp_encryption'), 'encryption' => data_get($notifiable, 'smtp_encryption') === 'none' ? null : data_get($notifiable, 'smtp_encryption'),
'username' => data_get($notifiable, 'smtp_username'), 'username' => data_get($notifiable, 'smtp_username'),
'password' => data_get($notifiable, 'smtp_password'), 'password' => data_get($notifiable, 'smtp_password'),
'timeout' => data_get($notifiable, 'smtp_timeout'), 'timeout' => data_get($notifiable, 'smtp_timeout'),
'local_domain' => null, 'local_domain' => null,
'auto_tls' => data_get($notifiable, 'smtp_encryption') === 'none' ? '0' : '',
]); ]);
} }
} }

View File

@@ -17,7 +17,8 @@
@if (isEmailEnabled($team) && auth()->user()->isAdminFromSession() && isTestEmailEnabled($team)) @if (isEmailEnabled($team) && auth()->user()->isAdminFromSession() && isTestEmailEnabled($team))
<x-modal-input buttonTitle="Send Test Email" title="Send Test Email"> <x-modal-input buttonTitle="Send Test Email" title="Send Test Email">
<form wire:submit.prevent="sendTestEmail" class="flex flex-col w-full gap-2"> <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 /> <x-forms.input wire:model="testEmailAddress" placeholder="test@example.com" id="testEmailAddress"
label="Recipients" required />
<x-forms.button type="submit" @click="modalOpen=false"> <x-forms.button type="submit" @click="modalOpen=false">
Send Email Send Email
</x-forms.button> </x-forms.button>
@@ -62,8 +63,11 @@
<div class="flex flex-col w-full gap-2 xl:flex-row"> <div class="flex flex-col w-full gap-2 xl:flex-row">
<x-forms.input required id="smtpHost" placeholder="smtp.mailgun.org" label="Host" /> <x-forms.input required id="smtpHost" placeholder="smtp.mailgun.org" label="Host" />
<x-forms.input required id="smtpPort" placeholder="587" label="Port" /> <x-forms.input required id="smtpPort" placeholder="587" label="Port" />
<x-forms.input id="smtpEncryption" helper="If SMTP uses SSL, set it to 'tls'." <x-forms.select id="smtpEncryption" label="Encryption">
placeholder="tls" label="Encryption" /> <option value="tls">TLS</option>
<option value="ssl">SSL</option>
<option value="none">None</option>
</x-forms.select>
</div> </div>
<div class="flex flex-col w-full gap-2 xl:flex-row"> <div class="flex flex-col w-full gap-2 xl:flex-row">
<x-forms.input id="smtpUsername" label="SMTP Username" /> <x-forms.input id="smtpUsername" label="SMTP Username" />

View File

@@ -33,8 +33,11 @@
<div class="flex flex-col w-full gap-2 xl:flex-row"> <div class="flex flex-col w-full gap-2 xl:flex-row">
<x-forms.input required id="smtpHost" placeholder="smtp.mailgun.org" label="Host" /> <x-forms.input required id="smtpHost" placeholder="smtp.mailgun.org" label="Host" />
<x-forms.input required id="smtpPort" placeholder="587" label="Port" /> <x-forms.input required id="smtpPort" placeholder="587" label="Port" />
<x-forms.input id="smtpEncryption" helper="If SMTP uses SSL, set it to 'tls'." placeholder="tls" <x-forms.select id="smtpEncryption" label="Encryption">
label="Encryption" /> <option value="tls">TLS</option>
<option value="ssl">SSL</option>
<option value="none">None</option>
</x-forms.select>
</div> </div>
<div class="flex flex-col w-full gap-2 xl:flex-row"> <div class="flex flex-col w-full gap-2 xl:flex-row">
<x-forms.input id="smtpUsername" label="SMTP Username" /> <x-forms.input id="smtpUsername" label="SMTP Username" />