Reference email image by cid for self hosted instances (#3957)

This commit is contained in:
Tom Moor
2022-08-14 16:50:49 +01:00
committed by GitHub
parent d8b4814aa9
commit 4d0473c22c
2 changed files with 16 additions and 1 deletions

View File

@@ -5,6 +5,7 @@ import Logger from "@server/logging/Logger";
import { APM } from "@server/logging/tracing";
import { baseStyles } from "./templates/components/EmailLayout";
const isCloudHosted = env.DEPLOYMENT === "hosted";
const useTestEmailService =
env.ENVIRONMENT === "development" && !env.SMTP_USERNAME;
@@ -77,6 +78,15 @@ export class Mailer {
subject: data.subject,
html,
text: data.text,
attachments: isCloudHosted
? undefined
: [
{
filename: "header-logo.png",
path: process.cwd() + "/public/email/header-logo.png",
cid: "header-image",
},
],
});
if (useTestEmailService) {

View File

@@ -4,6 +4,7 @@ import env from "@server/env";
import EmptySpace from "./EmptySpace";
const url = env.CDN_URL ?? env.URL;
const isCloudHosted = env.DEPLOYMENT === "hosted";
export default () => {
return (
@@ -14,7 +15,11 @@ export default () => {
<EmptySpace height={40} />
<img
alt="Outline"
src={`${url}/email/header-logo.png`}
src={
isCloudHosted
? `${url}/email/header-logo.png`
: "cid:header-image"
}
height="48"
width="48"
/>