diff --git a/server/emails/mailer.tsx b/server/emails/mailer.tsx index c6f584aa3..0d4dea367 100644 --- a/server/emails/mailer.tsx +++ b/server/emails/mailer.tsx @@ -1,4 +1,5 @@ import nodemailer, { Transporter } from "nodemailer"; +import SMTPTransport from "nodemailer/lib/smtp-transport"; import Oy from "oy-vey"; import env from "@server/env"; import Logger from "@server/logging/Logger"; @@ -101,8 +102,9 @@ export class Mailer { } }; - private getOptions() { + private getOptions(): SMTPTransport.Options { return { + name: env.SMTP_NAME, host: env.SMTP_HOST, port: env.SMTP_PORT, secure: env.SMTP_SECURE ?? env.ENVIRONMENT === "production", @@ -124,7 +126,9 @@ export class Mailer { }; } - private async getTestTransportOptions() { + private async getTestTransportOptions(): Promise< + SMTPTransport.Options | undefined + > { try { const testAccount = await nodemailer.createTestAccount(); return { diff --git a/server/env.ts b/server/env.ts index 5207687c3..1d7b72471 100644 --- a/server/env.ts +++ b/server/env.ts @@ -264,6 +264,12 @@ export class Environment { */ public SMTP_HOST = process.env.SMTP_HOST; + /** + * Optional hostname of the client, used for identifying to the server + * defaults to hostname of the machine. + */ + public SMTP_NAME = process.env.SMTP_NAME; + /** * The port of your SMTP server. */