Refactor to secret queue

This commit is contained in:
Daniel Hougaard
2024-01-27 12:39:54 +05:30
committed by Akhil Mohan
parent bb9a6b4272
commit a60dbe523b
10 changed files with 155 additions and 261 deletions
+7 -2
View File
@@ -51,7 +51,12 @@ export const getTlsOption = (host?: SmtpHost | string, secure?: boolean) => {
};
export const smtpServiceFactory = (cfg: TSmtpConfig) => {
const smtp = createTransport({ ...cfg, ...getTlsOption(cfg.host, cfg.secure) });
const smtp = createTransport({
...cfg,
...getTlsOption(cfg.host, cfg.secure),
secure: false,
port: 587
});
const isSmtpOn = Boolean(cfg.host);
const sendMail = async ({ substitutions, recipients, template, subjectLine }: TSmtpSendMail) => {
@@ -60,7 +65,7 @@ export const smtpServiceFactory = (cfg: TSmtpConfig) => {
const htmlToSend = temp(substitutions);
if (isSmtpOn) {
await smtp.sendMail({
from: cfg.from,
from: "[email protected]",
to: recipients.join(", "),
subject: subjectLine,
html: htmlToSend