@ -46,7 +46,7 @@ export const executeSendEmailBlock = async (
|
||||
credentialsId: options.credentialsId,
|
||||
recipients: options.recipients.map(parseVariables(variables)),
|
||||
subject: parseVariables(variables)(options.subject ?? ''),
|
||||
body: parseVariables(variables)(options.body ?? ''),
|
||||
body: parseVariables(variables, { escapeHtml: true })(options.body ?? ''),
|
||||
cc: (options.cc ?? []).map(parseVariables(variables)),
|
||||
bcc: (options.bcc ?? []).map(parseVariables(variables)),
|
||||
replyTo: options.replyTo
|
||||
|
@ -6,12 +6,14 @@ export type ParseVariablesOptions = {
|
||||
fieldToParse?: 'value' | 'id'
|
||||
escapeForJson?: boolean
|
||||
takeLatestIfList?: boolean
|
||||
escapeHtml?: boolean
|
||||
}
|
||||
|
||||
export const defaultParseVariablesOptions: ParseVariablesOptions = {
|
||||
fieldToParse: 'value',
|
||||
escapeForJson: false,
|
||||
takeLatestIfList: false,
|
||||
escapeHtml: false,
|
||||
}
|
||||
|
||||
export const parseVariables =
|
||||
@ -50,6 +52,8 @@ export const parseVariables =
|
||||
: value
|
||||
)
|
||||
if (!parsedValue) return dollarSign + ''
|
||||
if (options.escapeHtml)
|
||||
return parsedValue.replace(/</g, '<').replace(/>/g, '>')
|
||||
return parsedValue
|
||||
}
|
||||
)
|
||||
|
Reference in New Issue
Block a user