diff --git a/backend/src/services/smtp/smtp-service.ts b/backend/src/services/smtp/smtp-service.ts index 151127484..5e090b4c6 100644 --- a/backend/src/services/smtp/smtp-service.ts +++ b/backend/src/services/smtp/smtp-service.ts @@ -5,6 +5,7 @@ import handlebars from "handlebars"; import { createTransport } from "nodemailer"; import SMTPTransport from "nodemailer/lib/smtp-transport"; +import { getConfig } from "@app/lib/config/env"; import { logger } from "@app/lib/logger"; export type TSmtpConfig = SMTPTransport.Options; @@ -12,7 +13,7 @@ export type TSmtpSendMail = { template: SmtpTemplates; subjectLine: string; recipients: string[]; - substitutions: unknown; + substitutions: object; }; export type TSmtpService = ReturnType; @@ -47,9 +48,11 @@ export const smtpServiceFactory = (cfg: TSmtpConfig) => { const isSmtpOn = Boolean(cfg.host); const sendMail = async ({ substitutions, recipients, template, subjectLine }: TSmtpSendMail) => { + const appCfg = getConfig(); const html = await fs.readFile(path.resolve(__dirname, "./templates/", template), "utf8"); const temp = handlebars.compile(html); - const htmlToSend = temp(substitutions); + const htmlToSend = temp({ ...substitutions, isCloud: appCfg.isCloud }); + if (isSmtpOn) { await smtp.sendMail({ from: cfg.from, diff --git a/backend/src/services/smtp/templates/emailMfa.handlebars b/backend/src/services/smtp/templates/emailMfa.handlebars index 489c9dd30..936195c34 100644 --- a/backend/src/services/smtp/templates/emailMfa.handlebars +++ b/backend/src/services/smtp/templates/emailMfa.handlebars @@ -1,19 +1,19 @@ - - - + + + MFA Code - + - +

Infisical

Sign in attempt requires further verification

Your MFA code is below — enter it where you started signing in to Infisical.

{{code}}

The MFA code will be valid for 2 minutes.

-

Not you? Contact Infisical or your administrator immediately.

- +

Not you? Contact {{#if isCloud}}Infisical{{else}}your administrator{{/if}} immediately.

+ \ No newline at end of file diff --git a/backend/src/services/smtp/templates/newDevice.handlebars b/backend/src/services/smtp/templates/newDevice.handlebars index 654bb1ba3..6c7f2e9f6 100644 --- a/backend/src/services/smtp/templates/newDevice.handlebars +++ b/backend/src/services/smtp/templates/newDevice.handlebars @@ -1,19 +1,19 @@ - - - + + + Successful login for {{email}} from new device - + - +

Infisical

We're verifying a recent login for {{email}}:

Timestamp: {{timestamp}}

IP address: {{ip}}

User agent: {{userAgent}}

-

If you believe that this login is suspicious, please contact Infisical or reset your password immediately.

- +

If you believe that this login is suspicious, please contact {{#if isCloud}}Infisical{{else}}your administrator{{/if}} or reset your password immediately.

+ \ No newline at end of file diff --git a/backend/src/services/smtp/templates/passwordReset.handlebars b/backend/src/services/smtp/templates/passwordReset.handlebars index 3b136e859..6499a629c 100644 --- a/backend/src/services/smtp/templates/passwordReset.handlebars +++ b/backend/src/services/smtp/templates/passwordReset.handlebars @@ -9,6 +9,6 @@

Reset your password

Someone requested a password reset.

Reset password -

If you didn't initiate this request, please contact us immediately at team@infisical.com

+

If you didn't initiate this request, please contact {{#if isCloud}}us immediately at team@infisical.com.{{else}}your administrator immediately.{{/if}}

\ No newline at end of file