[add] action:email-test

This commit is contained in:
roydfalk 2024-06-10 13:45:47 +02:00
parent 36b704588f
commit bea4d793e4
3 changed files with 29 additions and 0 deletions

View file

@ -16,6 +16,7 @@
"help.args.action.description": "auszuführende Aktion; Auswahl", "help.args.action.description": "auszuführende Aktion; Auswahl",
"help.args.action.options.serve": "Server starten", "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.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.expose_conf": "Vollständige Konfiguration ausgeben",
"help.args.action.options.password_image": "Passwort-Abbild errechnen und auf Standard-Ausgabe schreiben", "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", "help.args.action.options.export_authelia": "Export der Nutzer-Datenbank im Authelia-user-Datei-Format auf Standard-Ausgabe schreiben",

View file

@ -16,6 +16,7 @@
"help.args.action.description": "action to executo; options", "help.args.action.description": "action to executo; options",
"help.args.action.options.serve": "start server", "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.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.expose_conf": "write complete configuration to stdout",
"help.args.action.options.password_image": "compute password image and write 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", "help.args.action.options.export_authelia": "export user database in Authelia user file format and write to stdout",

View file

@ -55,6 +55,10 @@ async function main(
"name": "api-doc", "name": "api-doc",
"description": lib_plankton.translate.get("help.args.action.options.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", "name": "expose-conf",
"description": lib_plankton.translate.get("help.args.action.options.expose_conf") "description": lib_plankton.translate.get("help.args.action.options.expose_conf")
@ -205,6 +209,29 @@ async function main(
); );
break; 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<string>
)
),
lib_plankton.string.coin(
"{{head}} | Test",
{
"head": _espe.conf.get().settings.organisation.name,
}
),
"This is a test e-mail"
);
break;
}
case "serve": { case "serve": {
// prepare database // prepare database
await _espe.database.check(); await _espe.database.check();