From 16b81fff380023e3795d7c7a82f7cd7de5ffbcc7 Mon Sep 17 00:00:00 2001
From: syuilo <Syuilotan@yahoo.co.jp>
Date: Thu, 4 Jul 2019 21:07:02 +0900
Subject: Resolve #3431

---
 src/client/app/admin/views/instance.vue | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

(limited to 'src/client/app/admin/views/instance.vue')

diff --git a/src/client/app/admin/views/instance.vue b/src/client/app/admin/views/instance.vue
index 588b24f6b5..7d271bcb89 100644
--- a/src/client/app/admin/views/instance.vue
+++ b/src/client/app/admin/views/instance.vue
@@ -129,6 +129,7 @@
 					<ui-input v-model="smtpPass" type="password" :with-password-toggle="true" :disabled="!enableEmail || !smtpAuth">{{ $t('smtp-pass') }}</ui-input>
 				</ui-horizon-group>
 				<ui-switch v-model="smtpSecure" :disabled="!enableEmail">{{ $t('smtp-secure') }}<template #desc>{{ $t('smtp-secure-info') }}</template></ui-switch>
+				<ui-button @click="testEmail()">{{ $t('test-email') }}</ui-button>
 			</template>
 		</section>
 		<section>
@@ -424,6 +425,32 @@ export default Vue.extend({
 			});
 		},
 
+		async testEmail() {
+			const { canceled, result: to } = await this.$root.dialog({
+				title: this.$t('test-email-to'),
+				input: {
+					type: 'email',
+				},
+				showCancelButton: true
+			});
+			if (canceled) return;
+			this.$root.api('admin/send-email', {
+				to: to,
+				subject: 'Test email',
+				text: 'Yo'
+			}).then(x => {
+				this.$root.dialog({
+					type: 'success',
+					splash: true
+				});
+			}).catch(e => {
+				this.$root.dialog({
+					type: 'error',
+					text: e
+				});
+			});
+		},
+
 		updateMeta() {
 			this.$root.api('admin/update-meta', {
 				maintainerName: this.maintainerName,
-- 
cgit v1.2.3-freya

