feat: Add optional SMTP_NAME configuration for connecting to SMTP servers that require the client to have a specific hostname
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user