From 3baa55c690dd9ba39768b8b271595cb6b09fe6da Mon Sep 17 00:00:00 2001 From: TheCatLady <52870424+TheCatLady@users.noreply.github.com> Date: Tue, 27 Apr 2021 19:23:51 -0400 Subject: [PATCH] fix(email): parse sender hostname from application URL (#1518) --- server/lib/email/index.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/server/lib/email/index.ts b/server/lib/email/index.ts index f9c0c7479..9f0a9fcfa 100644 --- a/server/lib/email/index.ts +++ b/server/lib/email/index.ts @@ -1,11 +1,15 @@ import Email from 'email-templates'; import nodemailer from 'nodemailer'; -import { NotificationAgentEmail } from '../settings'; +import { URL } from 'url'; +import { getSettings, NotificationAgentEmail } from '../settings'; import { openpgpEncrypt } from './openpgpEncrypt'; class PreparedEmail extends Email { public constructor(settings: NotificationAgentEmail, pgpKey?: string) { + const { applicationUrl } = getSettings().main; + const transport = nodemailer.createTransport({ + name: applicationUrl ? new URL(applicationUrl).hostname : undefined, host: settings.options.smtpHost, port: settings.options.smtpPort, secure: settings.options.secure,