Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an option for 'none' in mail encryption. #1152

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions app/Space/EnvironmentManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,8 @@ private function getMailData($request)
$oldMailData = "";
$newMailData = "";

$encryption = $request->mail_encryption === 'none' ? "" : $request->mail_encryption;

if (env('MAIL_FROM_ADDRESS') !== null && env('MAIL_FROM_NAME') !== null) {
$mailFromCredential =
'MAIL_FROM_ADDRESS='.config('mail.from.address')."\n".
Expand All @@ -296,7 +298,7 @@ private function getMailData($request)
'MAIL_PORT='.$request->mail_port."\n".
'MAIL_USERNAME='.$request->mail_username."\n".
'MAIL_PASSWORD='.$request->mail_password."\n".
'MAIL_ENCRYPTION='.$request->mail_encryption."\n\n".
'MAIL_ENCRYPTION='.$encryption."\n\n".
'MAIL_FROM_ADDRESS='.$request->from_mail."\n".
'MAIL_FROM_NAME="'.$request->from_name."\"\n\n";

Expand Down Expand Up @@ -352,7 +354,7 @@ private function getMailData($request)
'MAIL_PORT='.$request->mail_port."\n".
'MAIL_USERNAME='.config('mail.username')."\n".
'MAIL_PASSWORD='.config('mail.password')."\n".
'MAIL_ENCRYPTION='.$request->mail_encryption."\n\n".
'MAIL_ENCRYPTION='.$encryption."\n\n".
'MAIL_FROM_ADDRESS='.$request->from_mail."\n".
'MAIL_FROM_NAME="'.$request->from_name."\"\n\n";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,11 +151,14 @@ async function onTestMailSend() {
if (v$.value.$invalid) {
return true
}

isSaving.value = true
let response = await mailDriverStore.sendTestMail(formData)
if (response.data) {
closeTestModal()
try {
isSaving.value = true
let response = await mailDriverStore.sendTestMail(formData)
if (response.data) {
closeTestModal()
isSaving.value = false
}
} catch (err) {
isSaving.value = false
}
}
Expand Down
1 change: 1 addition & 0 deletions resources/scripts/admin/stores/mail-driver.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export const useMailDriverStore = (useWindow = false) => {
mailConfigData: null,
mail_driver: 'smtp',
mail_drivers: [],
mail_encryptions: ['none', 'tls', 'ssl', 'starttls'],

basicMailConfig: {
mail_driver: '',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,11 +214,11 @@ const props = defineProps({
const emit = defineEmits(['submit-data', 'on-change-driver'])

const { t } = useI18n()
const encryptions = reactive(['tls', 'ssl', 'starttls'])
let isShowPassword = ref(false)

const mailDriverStore = useMailDriverStore()

const encryptions = mailDriverStore.mail_encryptions
let isShowPassword = ref(false)

const sesConfig = computed(() => {
return mailDriverStore.sesConfig
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,12 +199,12 @@ const props = defineProps({

const emit = defineEmits(['submit-data', 'on-change-driver'])

const mailDriverStore = useMailDriverStore()

let isShowPassword = ref(false)
const encryptions = reactive(['tls', 'ssl', 'starttls'])
const encryptions = mailDriverStore.mail_encryptions
const { t } = useI18n()

const mailDriverStore = useMailDriverStore()

const smtpConfig = computed(() => {
return mailDriverStore.smtpConfig
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@
:content-loading="isFetchingInitialData"
:error="
v$.sesConfig.mail_ses_secret.$error &&
v$.mail_ses_secret.$errors[0].$message
v$.sesConfig.mail_ses_secret.$errors[0].$message
"
required
>
Expand Down Expand Up @@ -224,7 +224,7 @@ const mailDriverStore = useMailDriverStore()
const { t } = useI18n()

let isShowPassword = ref(false)
const encryptions = reactive(['tls', 'ssl', 'starttls'])
const encryptions = mailDriverStore.mail_encryptions

const rules = computed(() => {
return {
Expand Down Expand Up @@ -275,6 +275,9 @@ onMounted(() => {
for (const key in mailDriverStore.sesConfig) {
if (props.configData.hasOwnProperty(key)) {
mailDriverStore.sesConfig[key] = props.configData[key]
if (mailDriverStore.sesConfig.mail_encryption === '') {
mailDriverStore.sesConfig.mail_encryption = 'none'
}
}
}
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ const mailDriverStore = useMailDriverStore()
const { t } = useI18n()

let isShowPassword = ref(false)
const encryptions = reactive(['tls', 'ssl', 'starttls'])
const encryptions = mailDriverStore.mail_encryptions

const getInputType = computed(() => {
if (isShowPassword.value) {
Expand Down Expand Up @@ -256,6 +256,9 @@ onMounted(() => {
for (const key in mailDriverStore.smtpConfig) {
if (props.configData.hasOwnProperty(key)) {
mailDriverStore.smtpConfig[key] = props.configData[key]
if (mailDriverStore.smtpConfig.mail_encryption === '') {
mailDriverStore.smtpConfig.mail_encryption = 'none'
}
}
}
})
Expand Down