diff --git a/source/data/localization/deu.loc.json b/source/data/localization/deu.loc.json index 3508bd2..848fcf0 100644 --- a/source/data/localization/deu.loc.json +++ b/source/data/localization/deu.loc.json @@ -16,6 +16,7 @@ "help.args.action.description": "auszuführende Aktion; Auswahl", "help.args.action.options.serve": "Server starten", "help.args.action.options.api_doc": "API-Dokumentation gemäß OpenAPI-Spezifikation auf Standard-Ausgabe schreiben", + "help.args.action.options.email_test": "eine Test-E-Mail senden", "help.args.action.options.expose_conf": "Vollständige Konfiguration ausgeben", "help.args.action.options.password_image": "Passwort-Abbild errechnen und auf Standard-Ausgabe schreiben", "help.args.action.options.export_authelia": "Export der Nutzer-Datenbank im Authelia-user-Datei-Format auf Standard-Ausgabe schreiben", diff --git a/source/data/localization/eng.loc.json b/source/data/localization/eng.loc.json index b646b39..6883180 100644 --- a/source/data/localization/eng.loc.json +++ b/source/data/localization/eng.loc.json @@ -16,6 +16,7 @@ "help.args.action.description": "action to executo; options", "help.args.action.options.serve": "start server", "help.args.action.options.api_doc": "write API documentation according to OpenAPI specification to stdout", + "help.args.action.options.email_test": "send a test e-mail", "help.args.action.options.expose_conf": "write complete configuration to stdout", "help.args.action.options.password_image": "compute password image and write to stdout", "help.args.action.options.export_authelia": "export user database in Authelia user file format and write to stdout", diff --git a/source/main.ts b/source/main.ts index 78a59e3..9c252a9 100644 --- a/source/main.ts +++ b/source/main.ts @@ -55,6 +55,10 @@ async function main( "name": "api-doc", "description": lib_plankton.translate.get("help.args.action.options.api_doc") }, + { + "name": "email-test", + "description": lib_plankton.translate.get("help.args.action.options.email_test") + }, { "name": "expose-conf", "description": lib_plankton.translate.get("help.args.action.options.expose_conf") @@ -205,6 +209,29 @@ async function main( ); break; } + case "email-test": { + await _espe.helpers.email_send( + ( + (args["arg1"] !== null) + ? [args["arg1"]] + : ( + ( + _espe.conf.get().admins + .map(admin => admin.email_address) + .filter(x => (x !== null)) + ) as Array + ) + ), + lib_plankton.string.coin( + "{{head}} | Test", + { + "head": _espe.conf.get().settings.organisation.name, + } + ), + "This is a test e-mail" + ); + break; + } case "serve": { // prepare database await _espe.database.check();