fix(integrations): 🚑️ Empty body emails
This commit is contained in:
@ -10,6 +10,7 @@ import { createTransport, getTestMessageUrl } from 'nodemailer'
|
|||||||
import {
|
import {
|
||||||
decrypt,
|
decrypt,
|
||||||
initMiddleware,
|
initMiddleware,
|
||||||
|
isEmpty,
|
||||||
isNotDefined,
|
isNotDefined,
|
||||||
methodNotAllowed,
|
methodNotAllowed,
|
||||||
omit,
|
omit,
|
||||||
@ -157,7 +158,7 @@ const getEmailBody = async ({
|
|||||||
SendEmailOptions,
|
SendEmailOptions,
|
||||||
'isCustomBody' | 'isBodyCode' | 'body'
|
'isCustomBody' | 'isBodyCode' | 'body'
|
||||||
>): Promise<{ html?: string; text?: string } | undefined> => {
|
>): Promise<{ html?: string; text?: string } | undefined> => {
|
||||||
if (isCustomBody || isNotDefined(isCustomBody))
|
if (isCustomBody || (isNotDefined(isCustomBody) && !isEmpty(body)))
|
||||||
return {
|
return {
|
||||||
html: isBodyCode ? body : undefined,
|
html: isBodyCode ? body : undefined,
|
||||||
text: !isBodyCode ? body : undefined,
|
text: !isBodyCode ? body : undefined,
|
||||||
|
@ -22,6 +22,7 @@ export const sendEmailBlockSchema = blockBaseSchema.and(
|
|||||||
|
|
||||||
export const defaultSendEmailOptions: SendEmailOptions = {
|
export const defaultSendEmailOptions: SendEmailOptions = {
|
||||||
credentialsId: 'default',
|
credentialsId: 'default',
|
||||||
|
isCustomBody: false,
|
||||||
recipients: [],
|
recipients: [],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user