diff --git a/dashboard/src/views/EmailDomainView.vue b/dashboard/src/views/EmailDomainView.vue index f7a33d5d9..7c6a1427d 100644 --- a/dashboard/src/views/EmailDomainView.vue +++ b/dashboard/src/views/EmailDomainView.vue @@ -14,10 +14,12 @@ import MailRelaySettingsItem from '../components/MailRelaySettingsItem.vue'; import DashboardModel from '../models/DashboardModel.js'; import DomainsModel from '../models/DomainsModel.js'; import MailModel from '../models/MailModel.js'; +import ProfileModel from '../models/ProfileModel.js'; const dashboardModel = DashboardModel.create(); const domainsModel = DomainsModel.create(); const mailModel = MailModel.create(); +const profileModel = ProfileModel.create(); const inputDialog = useTemplateRef('inputDialog'); const enableIncomingDialog = useTemplateRef('enableIncomingDialog'); @@ -37,12 +39,14 @@ const inboundEnabled = ref(false); const outboundEnabled = ref(false); const usage = ref(0); -// TODO -async function onSendTestMail(domain) { +async function onSendTestMail() { + const [error, result] = await profileModel.get(); + if (error) return console.error(error); + const address = await inputDialog.value.prompt({ - value: profile.value.email, - title: t('emails.testMailDialog.title', { domain: domain.domain }), - message: t('emails.testMailDialog.description', { domain: domain.domain }), + value: result.email, + title: t('emails.testMailDialog.title', { domain: domain.value }), + message: t('emails.testMailDialog.description', { domain: domain.value }), confirmLabel: t('emails.testMailDialog.sendAction'), rejectLabel: t('main.dialog.cancel'), rejectStyle: 'secondary' @@ -50,10 +54,10 @@ async function onSendTestMail(domain) { if (!address) return; - const [error] = await mailModel.sendTestMail(domain.domain, address); - if (error) { - window.pankow.notify({ text: error.body ? error.body.message : 'Failed to send mail', type: 'danger' }); - return console.error(error); + const [sendError] = await mailModel.sendTestMail(domain.value, address); + if (sendError) { + window.pankow.notify({ text: sendError.body ? sendError.body.message : 'Failed to send mail', type: 'danger' }); + return console.error(sendError); } window.pankow.notify({ text: 'Mail sent', type: 'success' }); @@ -303,6 +307,10 @@ onMounted(async () => {
+ +