Fix error when adding attachments (#82)

This commit is contained in:
Xavi Velàsquez
2024-11-28 22:28:26 +01:00
committed by GitHub
parent 9f182e8748
commit 26f42e6e9e
2 changed files with 7 additions and 4 deletions

View File

@@ -204,9 +204,9 @@ export async function sendEmailWithAttachments({
const boundary = "NextPart";
let rawEmail = `From: ${from}\n`;
rawEmail += `To: ${Array.isArray(to) ? to.join(", ") : to}\n`;
rawEmail += `Cc: ${cc ? cc.join(", ") : ""}\n`;
rawEmail += `Bcc: ${bcc ? bcc.join(", ") : ""}\n`;
rawEmail += `Reply-To: ${replyTo}\n`;
rawEmail += cc && cc.length ? `Cc: ${cc.join(", ")}\n` : "";
rawEmail += bcc && bcc.length ? `Bcc: ${bcc.join(", ")}\n` : "";
rawEmail += replyTo && replyTo.length ? `Reply-To: ${replyTo.join(", ")}\n` : "";
rawEmail += `Subject: ${subject}\n`;
rawEmail += `MIME-Version: 1.0\n`;
rawEmail += `Content-Type: multipart/mixed; boundary="${boundary}"\n\n`;
@@ -256,7 +256,7 @@ export async function addWebhookConfiguration(
configName: string,
topicArn: string,
eventTypes: EventType[],
region: string
region: string,
) {
const sesClient = getSesClient(region);

View File

@@ -220,6 +220,9 @@ async function executeEmail(
to: email.to,
from: email.from,
subject: email.subject,
replyTo: email.replyTo ?? undefined,
bcc: email.bcc,
cc: email.cc,
text,
html: email.html ?? undefined,
region: domain?.region ?? env.AWS_DEFAULT_REGION,