2
0

fix(integrations): 🚑️ Empty body emails

This commit is contained in:
Baptiste Arnaud
2022-06-15 16:34:35 +02:00
parent 2a6e0652f2
commit 0ffdd88dba
2 changed files with 3 additions and 1 deletions

View File

@ -10,6 +10,7 @@ import { createTransport, getTestMessageUrl } from 'nodemailer'
import {
decrypt,
initMiddleware,
isEmpty,
isNotDefined,
methodNotAllowed,
omit,
@ -157,7 +158,7 @@ const getEmailBody = async ({
SendEmailOptions,
'isCustomBody' | 'isBodyCode' | 'body'
>): Promise<{ html?: string; text?: string } | undefined> => {
if (isCustomBody || isNotDefined(isCustomBody))
if (isCustomBody || (isNotDefined(isCustomBody) && !isEmpty(body)))
return {
html: isBodyCode ? body : undefined,
text: !isBodyCode ? body : undefined,

View File

@ -22,6 +22,7 @@ export const sendEmailBlockSchema = blockBaseSchema.and(
export const defaultSendEmailOptions: SendEmailOptions = {
credentialsId: 'default',
isCustomBody: false,
recipients: [],
}