diff --git a/CHANGELOG.md b/CHANGELOG.md
index f8a34fcb7e..17b622381b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -26,6 +26,7 @@ unreleased
* APNGサポート
* アバターファイル選択でimage以外は表示しないように
* データベース手動バキューム機能
+* メールサーバー設定が正しいか確認できるように
* ピン止めの上限に達したときエラーを表示するように
* AP: attributedTo, to, cc が Array や Object のパターンに対応
* AP: object type が Audio, Document, Image, Page, Video のパターンに対応
diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml
index f6e36c045f..6040be0450 100644
--- a/locales/ja-JP.yml
+++ b/locales/ja-JP.yml
@@ -1389,6 +1389,8 @@ admin/views/instance.vue:
smtp-auth: "SMTP認証を行う"
smtp-user: "SMTPユーザー"
smtp-pass: "SMTPパスワード"
+ test-email: "テスト"
+ test-email-to: "テストメールの送信先アドレス"
serviceworker-config: "ServiceWorker"
enable-serviceworker: "ServiceWorkerを有効にする"
serviceworker-info: "プッシュ通知を行うには有効する必要があります。"
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 @@
{{ $t('smtp-pass') }}
{{ $t('smtp-secure') }}{{ $t('smtp-secure-info') }}
+ {{ $t('test-email') }}
@@ -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,
diff --git a/src/server/api/endpoints/admin/send-email.ts b/src/server/api/endpoints/admin/send-email.ts
new file mode 100644
index 0000000000..fed4f2df14
--- /dev/null
+++ b/src/server/api/endpoints/admin/send-email.ts
@@ -0,0 +1,26 @@
+import $ from 'cafy';
+import define from '../../define';
+import { sendEmail } from '../../../../services/send-email';
+
+export const meta = {
+ tags: ['admin'],
+
+ requireCredential: true,
+ requireModerator: true,
+
+ params: {
+ to: {
+ validator: $.str,
+ },
+ subject: {
+ validator: $.str,
+ },
+ text: {
+ validator: $.str,
+ },
+ }
+};
+
+export default define(meta, async (ps) => {
+ await sendEmail(ps.to, ps.subject, ps.text);
+});