Implement mailfrom/masquerading setting

This commit is contained in:
Johannes Zellner
2025-03-11 12:50:05 +01:00
parent a5ca8781ff
commit 5c354db1b2
2 changed files with 25 additions and 1 deletions
+11
View File
@@ -72,6 +72,17 @@ function create() {
if (result.status !== 202) return [result];
return [null];
},
async setMailFromValidation(domain, enabled) {
let result;
try {
result = await fetcher.post(`${API_ORIGIN}/api/v1/mail/${domain}/mail_from_validation`, { enabled }, { access_token: accessToken });
} catch (e) {
return [e];
}
if (result.status !== 202) return [result];
return [null];
},
async setEnabled(domain, enabled) {
let result;
try {
+14 -1
View File
@@ -79,7 +79,20 @@ async function onEnableIncoming() {
const mailFromValidation = ref(false);
const mailFromValidationBusy = ref(false);
async function onToggleMailFromValidation(value) {
mailFromValidationBusy.value = true;
const [error] = await mailModel.setMailFromValidation(domain.value, value);
if (error) {
mailFromValidation.value = !value;
mailFromValidationBusy.value = false;
return console.error(error);
}
mailFromValidationBusy.value = false;
}
async function refreshMailConfig() {
@@ -148,7 +161,7 @@ onMounted(async () => {
<label>{{ $t('email.masquerading.title') }}</label>
<div v-html="$t('email.masquerading.description')"></div>
</FormGroup>
<Switch v-model="mailFromValidation" @change="onToggleMailFromValidation"/>
<Switch v-model="mailFromValidation" @change="onToggleMailFromValidation" :disabled="mailFromValidationBusy"/>
</SettingsItem>
<CatchAllSettingsItem :domain-config="mailConfig" />