mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-09-22 13:39:35 +00:00
Update smtp-service.ts
This commit is contained in:
committed by
Akhil Mohan
parent
edd78eaeba
commit
dcdcc40a4a
@@ -51,10 +51,7 @@ export const getTlsOption = (host?: SmtpHost | string, secure?: boolean) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const smtpServiceFactory = (cfg: TSmtpConfig) => {
|
export const smtpServiceFactory = (cfg: TSmtpConfig) => {
|
||||||
const smtp = createTransport({
|
const smtp = createTransport({ ...cfg, ...getTlsOption(cfg.host, cfg.secure) });
|
||||||
...cfg,
|
|
||||||
...getTlsOption(cfg.host, cfg.secure)
|
|
||||||
});
|
|
||||||
const isSmtpOn = Boolean(cfg.host);
|
const isSmtpOn = Boolean(cfg.host);
|
||||||
|
|
||||||
const sendMail = async ({ substitutions, recipients, template, subjectLine }: TSmtpSendMail) => {
|
const sendMail = async ({ substitutions, recipients, template, subjectLine }: TSmtpSendMail) => {
|
||||||
@@ -63,6 +60,7 @@ export const smtpServiceFactory = (cfg: TSmtpConfig) => {
|
|||||||
const htmlToSend = temp(substitutions);
|
const htmlToSend = temp(substitutions);
|
||||||
if (isSmtpOn) {
|
if (isSmtpOn) {
|
||||||
await smtp.sendMail({
|
await smtp.sendMail({
|
||||||
|
from: cfg.from,
|
||||||
to: recipients.join(", "),
|
to: recipients.join(", "),
|
||||||
subject: subjectLine,
|
subject: subjectLine,
|
||||||
html: htmlToSend
|
html: htmlToSend
|
||||||
|
|||||||
Reference in New Issue
Block a user