Add send-test-email script.

This commit is contained in:
zkldi
2021-11-03 00:51:39 +00:00
parent d2bdba8372
commit 52ac1d4b01
+29
View File
@@ -0,0 +1,29 @@
import { Command } from "commander";
import { SendEmail } from "lib/email/client";
import { MainHTMLWrapper } from "lib/email/formats";
import CreateLogCtx from "lib/logger/logger";
const program = new Command();
program.option("-e, --email <Email to send to>");
const logger = CreateLogCtx(__filename);
program.parse(process.argv);
const options = program.opts();
if (!options.email) {
throw new Error(`Need an --email to send to.`);
}
if (require.main === module) {
(async () => {
logger.info(`Sending email to ${options.email}.`);
await SendEmail(
options.email,
"Hello World",
MainHTMLWrapper("Hello world! This is a test email for doing things.")
);
logger.info(`Done.`);
process.exit(0);
})();
}